public bool ActivateTrialLicense(out bool hasError, out int status, string firstName, string lastName, string eMail, string organization, Guid userId)
        {
            status = LexActivator.SetTrialActivationMetadata("FirstName", firstName);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata FirstName Code {status}");
                hasError = true;
                return(false);
            }
            status = LexActivator.SetTrialActivationMetadata("LastName", lastName);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata LastName Code {status}");
                hasError = true;
                return(false);
            }
            status = LexActivator.SetTrialActivationMetadata("eMail", eMail);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata eMail Code {status}");
                hasError = true;
                return(false);
            }

            status = LexActivator.SetTrialActivationMetadata("Organization", organization);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata Organization Code {status}");
                hasError = true;
                return(false);
            }

            status = LexActivator.SetTrialActivationMetadata("UserId", userId.ToString());
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata UserId Code {status}");
                hasError = true;
                return(false);
            }

            status = LexActivator.ActivateTrial();
            var statusEnum = (StatusCodesEnum)status;

            if (statusEnum == StatusCodesEnum.LA_OK)
            {
                hasError = false;
                Init();
                return(true);
            }
            else if (status == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
            {
                hasError = false;
                return(false);
            }
            else
            {
                hasError = false;
                return(false);
            }
        }
        private void Save(object sender, RoutedEventArgs e)
        {
            TxtFirstNameError.Visibility    = string.IsNullOrWhiteSpace(TxtFirstName.Value) ? Visibility.Visible : Visibility.Collapsed;
            TxtLastNameError.Visibility     = string.IsNullOrWhiteSpace(TxtLastName.Value) ? Visibility.Visible : Visibility.Collapsed;
            TxtEMailError.Visibility        = string.IsNullOrWhiteSpace(TxtEMail.Value) ? Visibility.Visible : Visibility.Collapsed;
            TxtOrganizationError.Visibility = string.IsNullOrWhiteSpace(TxtOrganization.Value) ? Visibility.Visible : Visibility.Collapsed;

            RegexUtilities util = new RegexUtilities();

            TxtEMailError.Visibility = util.IsValidEmail(TxtEMail.Value) == false ? Visibility.Visible : Visibility.Collapsed;

            if (TxtFirstNameError.Visibility == Visibility.Visible ||
                TxtLastNameError.Visibility == Visibility.Visible ||
                TxtEMailError.Visibility == Visibility.Visible ||
                TxtOrganizationError.Visibility == Visibility.Visible
                )
            {
                return;
            }

            var backgroundWorker = new BackgroundWorker
            {
                WorkerReportsProgress      = false,
                WorkerSupportsCancellation = false
            };

            backgroundWorker.DoWork             += BackgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            int lest;

            lest = LexActivator.SetTrialActivationMetadata("FirstName", TxtFirstName.Value);
            if (lest != LexActivator.StatusCodes.LA_OK)
            {
                return;
            }
            lest = LexActivator.SetTrialActivationMetadata("LastName", TxtLastName.Value);
            if (lest != LexActivator.StatusCodes.LA_OK)
            {
                return;
            }
            lest = LexActivator.SetTrialActivationMetadata("eMail", TxtEMail.Value);
            if (lest != LexActivator.StatusCodes.LA_OK)
            {
                return;
            }
            lest = LexActivator.SetTrialActivationMetadata("Organization", TxtOrganization.Value);
            if (lest != LexActivator.StatusCodes.LA_OK)
            {
                return;
            }

            RadBusyIndicator.IsBusy = true;

            backgroundWorker.RunWorkerAsync();
        }
        public bool SetIndexer(string serverId)
        {
            var status = LexActivator.SetTrialActivationMetadata("Indexer01", serverId);

            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata Indexer01 Code {status}");
                return(false);
            }
            return(true);
        }
Beispiel #4
0
 private void activateTrialBtn_Click(object sender, EventArgs e)
 {
     try
     {
         LexActivator.SetTrialActivationMetadata("key2", "value2");
         int status = LexActivator.ActivateTrial();
         if (status != LexStatusCodes.LA_OK)
         {
             this.statusLabel.Text = "Error activating the trial: " + status.ToString();
             return;
         }
         else
         {
             this.statusLabel.Text = "Trial started Successful";
         }
     }
     catch (LexActivatorException ex)
     {
         this.statusLabel.Text = "Error code: " + ex.Code.ToString() + " Error message: " + ex.Message;
     }
 }
Beispiel #5
0
        private void activateTrialBtn_Click(object sender, EventArgs e)
        {
            int status;

            status = LexActivator.SetTrialActivationMetadata("key2", "value2");
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error setting activation metadata: " + status.ToString();
                return;
            }
            status = LexActivator.ActivateTrial();
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                this.statusLabel.Text = "Error activating the trial: " + status.ToString();
                return;
            }
            else
            {
                this.statusLabel.Text = "Trial started Successful";
            }
        }
Beispiel #6
0
        private void ActivateTrialLicense(object obj)
        {
            IsBusy = true;

            int status;

            status = LexActivator.SetTrialActivationMetadata("FirstName", FirstName);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata FirstName Code {status}");
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                {
                    IsBusy = false;
                    SendErrorLogVisibility = Visibility.Visible;
                    Status = LocHelper.GetWord("Error setting activation data.");
                }));
                return;
            }
            status = LexActivator.SetTrialActivationMetadata("LastName", LastName);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata LastName Code {status}");
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                {
                    IsBusy = false;
                    SendErrorLogVisibility = Visibility.Visible;
                    Status = LocHelper.GetWord("Error setting activation data.");
                }));
                return;
            }
            status = LexActivator.SetTrialActivationMetadata("eMail", EMail);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata eMail Code {status}");
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                {
                    IsBusy = false;
                    SendErrorLogVisibility = Visibility.Visible;
                    Status = LocHelper.GetWord("Error setting activation data.");
                }));
                return;
            }
            status = LexActivator.SetTrialActivationMetadata("Organization", Organization);
            if (status != LexActivator.StatusCodes.LA_OK)
            {
                logger.Warn($"SetTrialActivationMetadata Organization Code {status}");
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                {
                    IsBusy = false;
                    SendErrorLogVisibility = Visibility.Visible;
                    Status = LocHelper.GetWord("Error setting activation data.");
                }));
                return;
            }
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
            {
                var activateTrial = LexActivator.ActivateTrial();
                var statusEnum    = (StatusCodesEnum)activateTrial;
                IsBusy            = false;
                if (statusEnum == StatusCodesEnum.LA_OK)
                {
                    Status = LocHelper.GetWord("You have successfully started your trial license. You can close this window and start using Celsus.");
                    CloseWindowVisibility = Visibility.Visible;
                }
                else if (status == LexActivator.StatusCodes.LA_TRIAL_EXPIRED)
                {
                    Status = LocHelper.GetWord("Product trial has expired.");
                    CloseWindowVisibility = Visibility.Visible;
                }
                else
                {
                    Status = LocHelper.GetWord($"Error occured. Error code {statusEnum.ToString()}");
                    CloseWindowVisibility = Visibility.Visible;
                }
            }));
            return;
        }