private void BtnActivate_Click(object sender, EventArgs e) { if (TxtKey.Text.Trim() == string.Empty) { ShowDialog("Input Licensing Key", Telerik.WinControls.RadMessageIcon.Info); return; } string key = TxtKey.Text.Trim(); if (!string.IsNullOrEmpty(key)) { EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicenseProvider.SetParameters(MyConfiguration.LICENSE_PARAMETERS); EncryptedLicense license = provider.InstallLicense(MyConfiguration.licenseFile, key); if (license == null) { ShowDialog("Invalid License Key Entered", Telerik.WinControls.RadMessageIcon.Info); return; } else { ShowDialog("Activated Successfully", Telerik.WinControls.RadMessageIcon.Info); this.Hide(); Application.DoEvents(); Installer Frm = new Installer(); Frm.ShowDialog(); Application.Exit(); } } }
protected virtual bool InstallLicenseKey(string key) { EncryptedLicenseProvider LicenseProvider = new EncryptedLicenseProvider(); EncryptedLicense license = LicenseProvider.ValidateLicenseKey(key); if (license == null) return false; else LicenseProvider.InstallLicense(MyConfiguration.licenseFile, license); return (license != null); }