static void Activate() { LexActivator.SetLicenseKey("PASTE_LICENSE_KEY"); LexActivator.SetActivationMetadata("key1", "value1"); int status = LexActivator.ActivateLicense(); if (LexStatusCodes.LA_OK == status || LexStatusCodes.LA_EXPIRED == status || LexStatusCodes.LA_SUSPENDED == status) { Console.WriteLine("License activated successfully: ", status); } else { Console.WriteLine("License activation failed: ", status); } }
private void activateBtn_Click(object sender, EventArgs e) { int status; if (this.activateBtn.Text == "Deactivate") { status = LexActivator.DeactivateLicense(); if (status == LexActivator.StatusCodes.LA_OK) { this.statusLabel.Text = "License deactivated successfully"; this.activateBtn.Text = "Activate"; this.activateTrialBtn.Enabled = true; return; } this.statusLabel.Text = "Error deactivating license: " + status.ToString(); return; } status = LexActivator.SetLicenseKey(productKeyBox.Text); if (status != LexActivator.StatusCodes.LA_OK) { this.statusLabel.Text = "Error setting license key: " + status.ToString(); return; } status = LexActivator.SetActivationMetadata("key1", "value1"); if (status != LexActivator.StatusCodes.LA_OK) { this.statusLabel.Text = "Error setting activation metadata: " + status.ToString(); return; } status = LexActivator.ActivateLicense(); if (status == LexActivator.StatusCodes.LA_OK || status == LexActivator.StatusCodes.LA_EXPIRED || status == LexActivator.StatusCodes.LA_SUSPENDED) { this.statusLabel.Text = "Activation Successful :" + status.ToString(); this.activateBtn.Text = "Deactivate"; this.activateTrialBtn.Enabled = false; } else { this.statusLabel.Text = "Error activating the license: " + status.ToString(); return; } }
public bool ActivateSerial(out bool hasError, out int status, string firstName, string lastName, string eMail, string organization, string serial) { status = LexActivator.SetActivationMetadata("FirstName", firstName); if (status != LexActivator.StatusCodes.LA_OK) { logger.Warn($"SetActivationMetadata FirstName Code {status}"); hasError = true; return(false); } status = LexActivator.SetActivationMetadata("LastName", lastName); if (status != LexActivator.StatusCodes.LA_OK) { logger.Warn($"SetActivationMetadata LastName Code {status}"); hasError = true; return(false); } status = LexActivator.SetActivationMetadata("eMail", eMail); if (status != LexActivator.StatusCodes.LA_OK) { logger.Warn($"SetActivationMetadata eMail Code {status}"); hasError = true; return(false); } status = LexActivator.SetActivationMetadata("Organization", organization); if (status != LexActivator.StatusCodes.LA_OK) { logger.Warn($"SetActivationMetadata Organization Code {status}"); hasError = true; return(false); } status = LexActivator.SetLicenseKey(serial); if (status != LexActivator.StatusCodes.LA_OK) { logger.Warn($"SetActivationMetadata Serial Code {status}"); hasError = true; return(false); } status = LexActivator.ActivateLicense(); var statusEnum = (StatusCodesEnum)status; if (statusEnum == StatusCodesEnum.LA_OK) { hasError = false; Init(); return(true); } else if (status == LexActivator.StatusCodes.LA_EXPIRED) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_SUSPENDED) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_REVOKED) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_FAIL) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_PRODUCT_ID) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_INET) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_VM) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_TIME) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_ACTIVATION_LIMIT) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_SERVER) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_CLIENT) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_LICENSE_KEY) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_LICENSE_TYPE) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_COUNTRY) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_IP) { hasError = false; return(false); } else if (status == LexActivator.StatusCodes.LA_E_RATE_LIMIT) { hasError = false; return(false); } else { hasError = false; return(false); } }