本文整理汇总了C#中License类的典型用法代码示例。如果您正苦于以下问题:C# License类的具体用法?C# License怎么用?C# License使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
License类属于命名空间,在下文中一共展示了License类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateCurrentLicense
public static void ValidateCurrentLicense()
{
lock (_validationLock)
{
CurrentLicense = ValidateLicense(LicenseFilePath);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例7: CancelAddLicense
public void CancelAddLicense()
{
var license = new License("TestLicense", "TestUrl", "TestLink");
this.facade.CancelCreateLicense(license);
LicensesPageAsserter.AssertLicenseNotExist(LicensesPage.Instance, license);
}
示例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 = "";
}
}
示例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);
}
}
示例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);
}
示例11: frmMain
public frmMain()
{
InitializeComponent();
dbConnect = new DBConnect();
License = new License();
}
示例12: AddLicenseWithValidData
public void AddLicenseWithValidData()
{
var license = new License("GiantLicense", "TestUrl", "TestLink");
this.facade.CreateLicense(license);
LicensesPageAsserter.AssertLicenseExist(LicensesPage.Instance, license);
}
示例13: LicensedColorComboBox
public LicensedColorComboBox()
{
license = LicenseManager.Validate(typeof(LicensedColorComboBox), this);
FillItems();
base.SelectedItem = base.Items[7]; // Black
base.DrawItem += new DrawItemEventHandler(this.combo_DrawItem);
}
示例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);
}
示例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);
}
}