Esempio n. 1
0
        private SlyceAuthorizer.LicenseStates InstallFullLicenseAuto()
        {
            if (ScreenStart.Action == ScreenStart.Actions.Activate)
            {
                if (!SlyceAuthorizer.IsValidLicenseNumber(textBoxSerial.Text))
                {
                    ShowMessageBox("Please enter a valid serial number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(SlyceAuthorizer.LicenseStates.NotChecked);
                }
                string message;

                if (SlyceAuthorizer.ActivateViaInternet(textBoxSerial.Text, "", "", true, out message))
                {
                    ShowMessageBox("Your license was installed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(SlyceAuthorizer.LicenseStates.Licensed);
                }
                ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(SlyceAuthorizer.LicenseStates.ServerValidationFailed);
            }
            return(SlyceAuthorizer.LicenseStates.ServerValidationFailed);
        }
Esempio n. 2
0
        private SlyceAuthorizer.LicenseStates GetNewTrialLicenseAuto()
        {
            if (SelectedPanel == panelContinueTrial)             // Trial
            {
                string        errorMessage;
                List <string> machineIds = SlyceAuthorizer.GetMachineIds(out errorMessage);

                if (machineIds.Count == 0)
                {
                    ShowMessageBox(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(SlyceAuthorizer.LicenseStates.HardwareNotMatched);
                }
                ShowMessage("Fetching trial license...");
                string message;

                if (SlyceAuthorizer.ActivateViaInternet("", machineIds[0], textBoxEmail.Text, false, out message))
                {
                    int  daysRemaining;
                    bool errorOccurred;
                    bool demo;
                    SlyceAuthorizer.LockTypes     lockType;
                    SlyceAuthorizer.LicenseStates status;
                    Licensing.SlyceAuthorizer.Reset();
                    bool licensed = Licensing.SlyceAuthorizer.IsLicensed("Visual NHibernate License.SlyceLicense", out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status);

                    if (licensed)
                    {
                        ShowMessage("Trial started");
                        ShowMessageBox("License installed.", "License Installed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (demo && daysRemaining >= 0)
                    {
                        ShowMessage("Trial running");
                        ShowMessageBox(string.Format("{0} days remaining.", daysRemaining), "Trial Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        SetRenewButtonsVisibility(true);
                        ShowMessage("Trial expired");
                        ShowMessageBox("Your trial has expired. Re-downloading won't help.\n\nGet a new serial when you purchase.", "Trial Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    return(status);
                }
                ShowMessage("Activation failed");
                ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(SlyceAuthorizer.LicenseStates.ServerValidationFailed);
            }
            else             // Full
            {
                if (!SlyceAuthorizer.IsValidLicenseNumber(textBoxSerial.Text))
                {
                    ShowMessageBox("Please enter a valid serial number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(SlyceAuthorizer.LicenseStates.LicenseFileNotFound);
                }
                ShowMessage("Fetching license...");
                string message;

                if (SlyceAuthorizer.ActivateViaInternet(textBoxSerial.Text, "", "", true, out message))
                {
                    LicenseMonitor.Reset();

                    if (LicenseMonitor.CurrentLicense.LicenseStatus == LicenseMonitor.LicenseStates.EvaluationExpired)
                    {
                        SetRenewButtonsVisibility(true);
                        ShowMessage("License expired");
                        ShowMessageBox("Your license has expired. Re-downloading won't help.\n\nGet a new serial when you purchase.", "Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return(SlyceAuthorizer.LicenseStates.EvaluationExpired);
                    }
                    else
                    {
                        ShowMessageBox("Your license was installed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(SlyceAuthorizer.LicenseStates.Licensed);
                    }
                }
                ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(SlyceAuthorizer.LicenseStates.ServerValidationFailed);
            }
        }
        private bool InstallAuto()
        {
            #region Activate Full License
            if (ScreenStart.Action == ScreenStart.Actions.Activate)
            {
                if (!SlyceAuthorizer.IsValidLicenseNumber(LicenseNumber))
                {
                    ShowMessageBox("Please enter a valid serial number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                string message;

                if (SlyceAuthorizer.ActivateViaInternet(LicenseNumber, "", "", true, out message))
                {
                    LicenseMonitor.Reset();
                    ShowMessageBox("Your license was installed successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true);
                }
                ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            #endregion

            #region Activate Trial License
            if (ScreenStart.Action == ScreenStart.Actions.Trial)
            {
                string        errorMessage;
                List <string> machineIds = SlyceAuthorizer.GetMachineIds(out errorMessage);

                if (machineIds.Count == 0)
                {
                    ShowMessageBox(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                string message;
                //throw new NotImplementedException("WTF!");

                if (SlyceAuthorizer.ActivateViaInternet("", machineIds[0], "oops", false, out message))
                {
                    int  daysRemaining;
                    bool errorOccurred;
                    bool demo;
                    SlyceAuthorizer.LockTypes     lockType;
                    SlyceAuthorizer.LicenseStates status;
                    Licensing.SlyceAuthorizer.Reset();
                    bool licensed = Licensing.SlyceAuthorizer.IsLicensed("Visual NHibernate License.SlyceLicense", out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status);

                    if (licensed)
                    {
                        ShowMessageBox("License installed.", "License Installed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (demo && daysRemaining >= 0)
                    {
                        ShowMessageBox(string.Format("{0} days remaining.", daysRemaining), "Trial Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        ShowMessageBox("Your trial has expired.", "Trial Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    return(true);
                }
                ShowMessageBox("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            #endregion

            return(false);
        }