コード例 #1
0
ファイル: ActivationGui.cs プロジェクト: chuongmep/RabCab
        /// <summary>Put this app in either trial mode or "full mode"</summary>
        /// <param name="show">If true show the trial, otherwise hide the trial.</param>
        private void ShowTrial(bool show)
        {
            lblTrialMessage.Visible = show;

            ActDtBtn.Text = show ? "Activate..." : "Deactivate";

            if (show)
            {
                uint trialDaysRemaining = 0;

                try
                {
                    ta.UseTrial(trialFlags);

                    // get the number of remaining trial days
                    trialDaysRemaining = ta.TrialDaysRemaining(trialFlags);
                }
                catch (TrialExpiredException)
                {
                    // do nothing because trialDaysRemaining is already set to 0
                }
                catch (TurboActivateException ex)
                {
                    MessageBox.Show("Failed to start the trial: " + ex.Message);
                }

                // if no more trial days then disable all app features
                if (trialDaysRemaining == 0)
                {
                    DisableAppFeatures();
                }
                else
                {
                    InitPlugin.HasTime = true;
                    Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(
                        "\nRabCab is in trial mode! Your trial expires in " + trialDaysRemaining + " days.");
                    lblTrialMessage.Text = "Your trial expires in " + trialDaysRemaining + " days.";
                }
            }
        }
コード例 #2
0
        /// <summary>Put this app in either trial mode or "full mode"</summary>
        /// <param name="show">If true show the trial, otherwise hide the trial.</param>
        void ShowTrial(bool show)
        {
            lblTrialMessage.Visible = show;
            btnExtendTrial.Visible  = show;

            mnuActDeact.Text = show ? "Activate..." : "Deactivate";

            if (show)
            {
                uint trialDaysRemaining = 0;

                try
                {
                    ta.UseTrial(trialFlags);

                    // get the number of remaining trial days
                    trialDaysRemaining = ta.TrialDaysRemaining(trialFlags);
                }
                catch (TrialExpiredException)
                {
                    // do nothing because trialDaysRemaining is already set to 0
                }
                catch (TurboActivateException ex)
                {
                    MessageBox.Show("Failed to start the trial: " + ex.Message);
                }

                // if no more trial days then disable all app features
                if (trialDaysRemaining == 0)
                {
                    DisableAppFeatures();
                }
                else
                {
                    lblTrialMessage.Text = "Your trial expires in " + trialDaysRemaining + " days.";
                }
            }
        }