private void btnGenLicense_Click(object sender, EventArgs e) { if (_lic == null) { throw new ArgumentException("LicenseEntity is invalid"); } if (rdoSingleLicense.Checked) { if (LicenseHandler.ValidateUIDFormat(txtUID.Text.Trim())) { _lic.Type = LicenseTypes.Single; _lic.UID = txtUID.Text.Trim(); } else { MessageBox.Show("License UID is blank or invalid", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else if (rdoVolumeLicense.Checked) { _lic.Type = LicenseTypes.Volume; _lic.UID = string.Empty; } _lic.CreateDateTime = DateTime.Now; if (OnLicenseSettingsValidating != null) { LicenseSettingsValidatingEventArgs _args = new LicenseSettingsValidatingEventArgs() { License = _lic, CancelGenerating = false }; OnLicenseSettingsValidating(this, _args); if (_args.CancelGenerating) { return; } } if (OnLicenseGenerated != null) { string _licStr = LicenseHandler.GenerateLicenseBASE64String(_lic, CertificatePrivateKeyData, CertificatePassword); OnLicenseGenerated(this, new LicenseGeneratedEventArgs() { LicenseBASE64String = _licStr }); } }
private void btnGenLicense_Click(object sender, EventArgs e) { if (_lic == null) throw new ArgumentException("LicenseEntity is invalid"); if (rdoSingleLicense.Checked) { if (LicenseHandler.ValidateUIDFormat(txtUID.Text.Trim())) { _lic.Type = LicenseTypes.Single; _lic.UID = txtUID.Text.Trim(); } else { MessageBox.Show("License UID is blank or invalid", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else if (rdoVolumeLicense.Checked) { _lic.Type = LicenseTypes.Volume; _lic.UID = string.Empty; } _lic.CreateDateTime = DateTime.Now; if (OnLicenseSettingsValidating != null) { LicenseSettingsValidatingEventArgs _args = new LicenseSettingsValidatingEventArgs() { License = _lic, CancelGenerating = false }; OnLicenseSettingsValidating(this, _args); if (_args.CancelGenerating) { return; } } if (OnLicenseGenerated != null) { string _licStr = LicenseHandler.GenerateLicenseBASE64String(_lic, CertificatePrivateKeyFilePath, CertificatePassword); OnLicenseGenerated(this, new LicenseGeneratedEventArgs() { LicenseBASE64String = _licStr }); } }