• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# License类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Execute

		public override void Execute()
		{
			var orderMessage = documentSession.Load<OrderMessage>(OrderId);

			var license = new License
			{
				Key = Guid.NewGuid(),
				OrderId = orderMessage.Id
			};
			documentSession.Store(license);

			TaskExecuter.ExecuteLater(new SendEmailTask
			{
				From = "[email protected]",
				To = orderMessage.Email,
				Subject = "Congrats on your new tekpub thingie",
				Template = "NewOrder",
				ViewContext = new
				{
					orderMessage.OrderId,
					orderMessage.Name,
					orderMessage.Amount,
					LiceseKey = license.Key
				}
			});

			orderMessage.Handled = true;
		}
开发者ID:hlobil,项目名称:TekPub.Profiler.BackOffice,代码行数:28,代码来源:ProcessOrderMessageTask.cs


示例17: IsNormalLicenseExpired

        protected override bool IsNormalLicenseExpired(License license, DateTime expirationDateTime, DateTime validationDateTime)
        {
            var entryAssembly = AssemblyHelper.GetEntryAssembly();
            var linkerTimestamp = entryAssembly.GetBuildDateTime();

            return (linkerTimestamp > expirationDateTime);
        }
开发者ID:sk8tz,项目名称:Orc.LicenseManager,代码行数:7,代码来源:PreventUsageOfLaterReleasedVersionsBehavior.cs


示例18: ShowWindow

        public static bool ShowWindow()
        {
            string keySW = "Software";
              string keyESRI = "ESRI";
              string keyDF = "DeedDrafter";
              string keyExecute = "Execute";

              string acceptValue = "{61F78689-7E9A-47CC-B8F0-DC4428AD4937}";

              RegistryKey regKeySW = Registry.CurrentUser.OpenSubKey(keySW);
              if (regKeySW != null)
              {
            RegistryKey regKeyESRI = regKeySW.OpenSubKey(keyESRI);
            if (regKeyESRI != null)
            {
              RegistryKey regKeyDF = regKeyESRI.OpenSubKey(keyDF);
              if (regKeyDF != null)
              {
            object value = regKeyDF.GetValue(keyExecute, "");
            if (value.ToString() == acceptValue)
              return true;
              }
            }
              }

              var license = new License();
              license.ShowDialog();

              if (license.Agreed)
              {
            // If we have any errors, allow the app to start, but
            // the user will have to accept the agreement again :(
            if (regKeySW == null)
              return true;

            try
            {
              regKeySW = Registry.CurrentUser.OpenSubKey(keySW, RegistryKeyPermissionCheck.ReadWriteSubTree);
              if (regKeySW == null)
            return true;

              RegistryKey regKeyESRI = regKeySW.OpenSubKey(keyESRI, RegistryKeyPermissionCheck.ReadWriteSubTree);
              if (regKeyESRI == null)
            regKeyESRI = regKeySW.CreateSubKey(keyESRI, RegistryKeyPermissionCheck.ReadWriteSubTree);
              if (regKeyESRI == null)
            return true;

              RegistryKey regKeyDF = regKeyESRI.OpenSubKey(keyDF, RegistryKeyPermissionCheck.ReadWriteSubTree);
              if (regKeyDF == null)
            regKeyDF = regKeyESRI.CreateSubKey(keyDF, RegistryKeyPermissionCheck.ReadWriteSubTree);
              if (regKeyDF == null)
            return true;

              regKeyDF.SetValue(keyExecute, acceptValue);
            }
            catch { }
              }

              return license.Agreed;
        }
开发者ID:Esri,项目名称:deed-drafter,代码行数:60,代码来源:License.xaml.cs


示例19: NonExpiredLicense

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


示例20: frmMain

        public frmMain ()
        {
            InitializeComponent();

            //Obtain the license
            license = LicenseManager.Validate(typeof(frmMain), this);
        }
开发者ID:sldeskins,项目名称:HkSec,代码行数:7,代码来源:Form1.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Lifestyle类代码示例发布时间:2022-05-24
下一篇:
C# LibsndfileApi类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap