当前位置: 首页>>代码示例>>C#>>正文


C# License类代码示例

本文整理汇总了C#中License的典型用法代码示例。如果您正苦于以下问题:C# License类的具体用法?C# License怎么用?C# License使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


License类属于命名空间,在下文中一共展示了License类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateCurrentLicense

 public static void ValidateCurrentLicense()
 {
     lock (_validationLock)
     {
         CurrentLicense = ValidateLicense(LicenseFilePath);
     }
 }
开发者ID:sigcms,项目名称:Seeger,代码行数:7,代码来源:LicensingService.cs

示例2: PutLicense

        public IHttpActionResult PutLicense(int id, License license)
        {
            license.ModificationDate = DateTime.Now;

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != license.LicenseId)
            {
                return BadRequest();
            }
            
            _db.MarkAsModified(license);

            try
            {
                _db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LicenseExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:twerner93,项目名称:LicenseManagerNet,代码行数:34,代码来源:LicensesController.cs

示例3: Splash

		public Splash() : base() {
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
            _license = LicenseManager.Validate(typeof(Splash), this);
			
			//	Size to the image so as to display it fully and position the form in the center screen with no border.
			this.Size = this.BackgroundImage.Size;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

			//	Force the splash to stay on top while the mainform renders but don't show it in the taskbar.
			this.TopMost = true;
			this.ShowInTaskbar = false;
			
			//	Make the backcolour Fuchia and set that to be transparent
			//	so that the image can be shown with funny shapes, round corners etc.
			this.BackColor = System.Drawing.Color.Fuchsia;
			this.TransparencyKey = System.Drawing.Color.Fuchsia;

			//	Initialise a timer to do the fade out
			if (this.components == null) {
				this.components = new System.ComponentModel.Container();
			}
			this.fadeTimer = new System.Windows.Forms.Timer(this.components);
            //	Size to the image so as to display it fully and position the form in the center screen with no border.
            this.Size = this.BackgroundImage.Size;

		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:30,代码来源:Splash.cs

示例4: ExpiryAtExactInstance

 public void ExpiryAtExactInstance()
 {
     Instant expiry = Instant.FromUtc(2000, 1, 1, 0, 0, 0);
     StubClock clock = new StubClock(expiry);
     License license = new License(expiry, clock);
     Assert.IsTrue(license.HasExpired);
 }
开发者ID:noelitoa,项目名称:CSharpDesignPatterns,代码行数:7,代码来源:Demo.cs

示例5: GetLicenseState

        private static LicenseState GetLicenseState(Database db, License license, DateTime? buildDate, DateTime now, Dictionary<int, LicenseState> cache, Dictionary<int, string> errors)
        {
            LicenseState licenseState;

            if (cache.TryGetValue(license.LicenseId, out licenseState))
                return licenseState;

            ParsedLicense parsedLicense = ParsedLicenseManager.GetParsedLicense(license.LicenseKey);
            if (parsedLicense == null)
            {
                errors[license.LicenseId] = string.Format("The license key #{0} is invalid.", license.LicenseId);
                return null;
            }

            if (!parsedLicense.IsLicenseServerElligible())
            {
                errors[license.LicenseId] = string.Format("The license #{0}, of type {1}, cannot be used in the license server.",
                    license.LicenseId, parsedLicense.LicenseType);
                return null;
            }


            if ( !(buildDate == null || parsedLicense.SubscriptionEndDate == null || buildDate <= parsedLicense.SubscriptionEndDate ) )
            {
                errors[license.LicenseId] = string.Format("The maintenance subscription of license #{0} ends on {1:d} but the requested version has been built on {2:d}.",
                    license.LicenseId, parsedLicense.SubscriptionEndDate, buildDate);
                return null;
            }

           
            licenseState = new LicenseState(now, db, license, parsedLicense);
            cache.Add(license.LicenseId, licenseState);
            return licenseState;
           
        }
开发者ID:postsharp,项目名称:PostSharp.LicenseServer,代码行数:35,代码来源:LeaseService.cs

示例6: IsLicenseValidForSaving

		public ValidationResult IsLicenseValidForSaving(License license)
		{
			ValidationResult result = new ValidationResult();
			result.IsValid = true;

			if (String.IsNullOrEmpty(license.Name))
			{
				result.IsValid = false;
				result.ValidationErrors.Add("Project Name cannot be null.");
			}

			if (license.Product == null)
			{
				result.IsValid = false;
				result.ValidationErrors.Add("License project must contain a Product.");
			}

			if (license.KeyGeneratorType == KeyGeneratorTypes.None)
			{
				result.IsValid = false;
				result.ValidationErrors.Add("You must select a valid License Key Generator type.");
			}

			if (license.TrialSettings == null ||
				license.TrialSettings.ExpirationOptions == TrialExpirationOptions.None ||
				String.IsNullOrEmpty(license.TrialSettings.ExpirationData))
			{
				result.IsValid = false;
				result.ValidationErrors.Add("You must select a Trial Expiration type.");
			}

			return result;
		}
开发者ID:chantsunman,项目名称:Scutex,代码行数:33,代码来源:ValidationService.cs

示例7: CancelAddLicense

        public void CancelAddLicense()
        {
            var license = new License("TestLicense", "TestUrl", "TestLink");

            this.facade.CancelCreateLicense(license);
            LicensesPageAsserter.AssertLicenseNotExist(LicensesPage.Instance, license);
        }
开发者ID:plamenti,项目名称:Telerik2015,代码行数:7,代码来源:AddLicenseTest.cs

示例8: btnAddLicense_Click

        protected void btnAddLicense_Click(object sender, EventArgs e)
        {
            License license = new License();
            license.Software = txtBoxSoftware.Text;
            license.OS = txtBoxOperatingSystem.Text;
            license.Key = txtBoxKey.Text;
            license.NumOfCopies = Convert.ToInt32(txtBoxNumOfCopies.Text);
            license.ExpirationDate = txtBoxNumOfCopies.Text;
            license.ExpirationDate = txtBoxExpirationDate.Text;
            license.Notes = txtBoxNotes.Text;
            license.Type = ddlType.SelectedValue;

            lblMessage.Text = License.saveLicense(license);
            lblMessage.Visible = true;

            if (lblMessage.Text == "License created successfully!<bR>")
            {
                GridView1.DataBind();
                GridView2.DataBind();

                panelCreateLicense.Visible = false;
                btnCreateLicense.Visible = true;

                txtBoxSoftware.Text = "";
                txtBoxOperatingSystem.Text = "";
                txtBoxKey.Text = "";
                txtBoxNumOfCopies.Text = "";
                txtBoxExpirationDate.Text = "";
                txtBoxNotes.Text = "";
            }
        }
开发者ID:simxitnsz,项目名称:RED,代码行数:31,代码来源:ViewLicenses.aspx.cs

示例9: PromptUserForLicense

        public static License PromptUserForLicense(License currentLicense)
        {
            SynchronizationContext synchronizationContext = null;
            try
            {
                synchronizationContext = SynchronizationContext.Current;
                using (var form = new LicenseExpiredForm())
                {
                    form.CurrentLicense = currentLicense;
                    form.ShowDialog();
                    if (form.ResultingLicenseText == null)
                    {
                        return null;
                    }

                    new RegistryLicenseStore()
                        .StoreLicense(form.ResultingLicenseText);

                    return LicenseDeserializer.Deserialize(form.ResultingLicenseText);
                }

            }
            finally
            {
                SynchronizationContext.SetSynchronizationContext(synchronizationContext);
            }
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:27,代码来源:LicenseExpiredFormDisplayer.cs

示例10: Exports_With_User_Defined_KeyValues_When_Available

        public void Exports_With_User_Defined_KeyValues_When_Available()
        {
            var service = new ExportService() as IExportService;
            var product = new Product { Id = Guid.NewGuid(), Name = "My Product", };
            var license = new License
            {
                LicenseType = LicenseType.Standard, 
                OwnerName = "License Owner", 
                ExpirationDate = null,
            };
            
            license.Data.Add(new UserData { Key = "KeyOne", Value = "ValueOne"});
            license.Data.Add(new UserData { Key = "KeyTwo", Value = "ValueTwo"});

            var path = Path.GetTempFileName();
            var file = new FileInfo(path);

            service.Export(product, license, file);

            var reader = file.OpenText();
            var content = reader.ReadToEnd();

            Assert.NotNull(content);
            Assert.Contains("KeyOne=\"ValueOne\"", content);
            Assert.Contains("KeyTwo=\"ValueTwo\"", content);
        }
开发者ID:Rowandish,项目名称:rhino-licensing,代码行数:26,代码来源:ExportServiceTests.cs

示例11: frmMain

        public frmMain()
        {
            InitializeComponent();

            dbConnect = new DBConnect();
            License = new License();
        }
开发者ID:aaronkinder,项目名称:ShoreTel_Director_Password_Reset_Tool,代码行数:7,代码来源:frmMain.cs

示例12: AddLicenseWithValidData

        public void AddLicenseWithValidData()
        {
            var license = new License("GiantLicense", "TestUrl", "TestLink");

            this.facade.CreateLicense(license);
            LicensesPageAsserter.AssertLicenseExist(LicensesPage.Instance, license);
        }
开发者ID:plamenti,项目名称:Telerik2015,代码行数:7,代码来源:AddLicenseTest.cs

示例13: LicensedColorComboBox

 public LicensedColorComboBox()
 {
     license = LicenseManager.Validate(typeof(LicensedColorComboBox), this);
     FillItems();
     base.SelectedItem = base.Items[7]; // Black
     base.DrawItem += new DrawItemEventHandler(this.combo_DrawItem);
 }
开发者ID:sldeskins,项目名称:HkSec,代码行数:7,代码来源:LicensedColorComboBox.cs

示例14: Application_Start

        protected void Application_Start()
        {
            //Register areas
            AreaRegistration.RegisterAllAreas();

            //Set license
            License license = new License();
            license.SetLicense(@".\..\..\licenses\GroupDocs.Comparison.lic");

            //Register filters
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            //Create comparison settings
            var comparisonSettings = new ComparisonWidgetSettings
            {
                //Set root storage path
                RootStoragePath = Server.MapPath("~/App_Data/"),
                //Set comparison behavior
                ComparisonBehavior =
                {
                    StyleChangeDetection = true,
                    GenerateSummaryPage = true
                },
                //Set license for Viewer
                LicensePath = @".\..\..\licenses\GroupDocs.Viewer.lic"
            };

            //Initiate comparison widget
            ComparisonWidget.Init(comparisonSettings);
            //Register routes
            RouteConfig.RegisterRoutes(RouteTable.Routes, comparisonSettings);
            //Bundle scripts
            BundleConfigurator.Configure(comparisonSettings);
        }
开发者ID:groupdocs-comparison,项目名称:groupdocs-comparison-net-sample,代码行数:34,代码来源:Global.asax.cs

示例15: SelectedLicenseChanged

        //functions

        //Update the vie with the selected license
        public void SelectedLicenseChanged(string license, string count)
        {
            selectedlicense = null;
            int c = 0;
            try
            {
                c = int.Parse(count);
            }
            catch (Exception e)
            {
                Log.WriteLog("Error parsing int");
            }
            foreach (License l in list_allAvailableLicenses)
            {
                if (l.Name.Equals(license))
                {
                    selectedlicense = l;
                }
            }
            if (selectedlicense != null)
            {
                view.UpdateLicense(selectedlicense, c);
            }



        }
开发者ID:tiago-system13,项目名称:BP_LicenseAudit,代码行数:30,代码来源:ControllerChanges.cs


注:本文中的License类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。