private void ActivateLicense() { if (License != null) { License.Activate(); } }
private void BtnActivate_Click(object sender, RoutedEventArgs e) { if (_license.Activate(TbLicenseKey.Text.Trim())) { MessageBox.Show(Properties.Resources.PRODUCT_ACTIVATE, Properties.Resources.ACTIVE_PRODUCT, MessageBoxButton.OK, MessageBoxImage.Asterisk); var gestMail = new MainWindow(); gestMail.Show(); Close(); } else { MessageBox.Show(Properties.Resources.LICENSE_KEY_NO_VALID, Properties.Resources.ACTIVE_PRODUCT, MessageBoxButton.OK, MessageBoxImage.Error); } }
private async void ActivateLicense() { await lClass.GetRegistrationFirebase(tbLicense.Text.Trim()); if (lClass._user != null && !string.IsNullOrWhiteSpace(tbLicense.Text)) { if (lClass._user.ISACTIVATED == 0) { await emClass.SendMail(Globals.USE_EMAIL_GMAIL, Globals.EmailSenderUsername, Globals.EmailSenderPassword, lClass._user.EMAIL, "Score Manager License Activated", Globals.MSG_ACTIVATE); if (emClass.IsSuccessSendMail) { string pid = lClass.GetProcessorID(); await lClass.Activate(tbLicense.Text.Trim(), pid, lClass._user); lClass.GetLicenseNameEmail(lClass.GetLicenseKey(), out string name, out string email); MessageBox.Show(String.Format("License Key Accepted! \nInfo:\n\n{0} \n{1} \n", lClass._user.NAME, lClass._user.EMAIL), "License Activated Successfully", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } else { MessageBox.Show("Cannot proceed. Please check Internet connection and try again.", "Try Again", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("This license has already been activated with another device.", "Invalid Licence Key", MessageBoxButton.OK, MessageBoxImage.Exclamation); this.IsEnabled = true; tbLicense.SelectAll(); tbLicense.Focus(); } } else { MessageBox.Show("License maybe invalid or Internet connection is lost. Please try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); this.IsEnabled = true; tbLicense.SelectAll(); tbLicense.Focus(); } }