Beispiel #1
0
 private void deactivateButton_Click(object sender, EventArgs e)
 {
     if (m_licenseupdater.License.DeactivateOnline())
     {
         MessageBox.Show(this, "The license has been deactivated successfully.", "Deactivation", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show(this, "The license was not deactivated.  Error: (" + m_licenseupdater.License.LastError.ErrorNumber + ")" + m_licenseupdater.License.LastError.ErrorString, "Deactivation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     m_licenseupdater.validate();
     LoadStatus();
 }
Beispiel #2
0
        private void activateButton_Click(object sender, EventArgs e)
        {
            string lfContent  = "";
            bool   successful = false;

            activateButton.Enabled = false;
            Cursor = Cursors.WaitCursor;

            successful = m_License.ProcessActivateInstallationLicenseFileResponse(activationCodeTextBox.Text, ref lfContent);

            activateButton.Enabled = true;
            Cursor = Cursors.Default;

            if (!successful)
            {
                MessageBox.Show(this, "Activation Failed.  Reason: " + m_License.LastError.ErrorString, "Manual Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (m_License.SaveLicenseFile(lfContent))
            {
                MessageBox.Show(this, "Activation Successful!", "Manual Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                m_License.ResetSessionCode();
                m_licenseupdater.validate();
                Close();
            }
            else
            {
                MessageBox.Show(this, "Activation Failed.  Reason: " + m_License.LastError.ErrorString, "Manual Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #3
0
        private void activateButton_Click(object sender, EventArgs e)
        {
            try
            {
                Int32  licenseId  = 0;
                string password   = passwordTextBox.Text;
                bool   successful = false;

                if (string.IsNullOrEmpty(licenseIDTextBox.Text))
                {
                    MessageBox.Show(this, "Please enter a License ID.", "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    licenseIDTextBox.Focus();
                    return;
                }

                if (!Int32.TryParse(licenseIDTextBox.Text, out licenseId))
                {
                    MessageBox.Show(this, "The License ID may only contain numbers.", "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    licenseIDTextBox.Focus();
                    return;
                }

                if (!Int32.TryParse(licenseIDTextBox.Text, out licenseId))
                {
                    MessageBox.Show(this, "The License ID may only contain numbers.", "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    licenseIDTextBox.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(passwordTextBox.Text))
                {
                    MessageBox.Show(this, "Enter your password.", "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    passwordTextBox.Focus();
                    return;
                }

                m_license.InstallationName = installationNameTextBox.Text;

                successful = m_license.ActivateOnline(licenseId, password);

                if (successful)
                {
                    MessageBox.Show(this, "Activation Successful!", "Activation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    m_licenseupdater.validate();
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Activation Failed." + Environment.NewLine + Environment.NewLine + m_license.LastError.ToString(), "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Activation Failed." + Environment.NewLine + Environment.NewLine + ex.ToString(), "Activation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }