コード例 #1
0
ファイル: MainForm.cs プロジェクト: smile-ttxp/Paint.NET
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (PdnInfo.IsExpired)
            {
                foreach (Form form in Application.OpenForms)
                {
                    form.Enabled = false;
                }

                TaskButton checkForUpdatesTB = new TaskButton(
                    PdnResources.GetImageResource("Icons.MenuHelpCheckForUpdatesIcon.png").Reference,
                    PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ActionText"),
                    PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ExplanationText"));

                TaskButton goToWebSiteTB = new TaskButton(
                    PdnResources.GetImageResource("Icons.MenuHelpPdnWebsiteIcon.png").Reference,
                    PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ActionText"),
                    PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ExplanationText"));

                TaskButton doNotCheckForUpdatesTB = new TaskButton(
                    PdnResources.GetImageResource("Icons.CancelIcon.png").Reference,
                    PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ActionText"),
                    PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ExplanationText"));

                TaskButton[] taskButtons =
                    new TaskButton[]
                {
                    checkForUpdatesTB,
                    goToWebSiteTB,
                    doNotCheckForUpdatesTB
                };

                TaskButton clickedTB = TaskDialog.Show(
                    this,
                    Icon,
                    PdnInfo.GetFullAppName(),
                    PdnResources.GetImageResource("Icons.WarningIcon.png").Reference,
                    true,
                    PdnResources.GetString("ExpiredTaskDialog.InfoText"),
                    taskButtons,
                    checkForUpdatesTB,
                    doNotCheckForUpdatesTB,
                    450);

                if (clickedTB == checkForUpdatesTB)
                {
                    this.appWorkspace.CheckForUpdates();
                }
                else if (clickedTB == goToWebSiteTB)
                {
                    PdnInfo.LaunchWebSite(this, InvariantStrings.ExpiredPage);
                }

                Close();
            }
        }
コード例 #2
0
ファイル: PdnInfo.cs プロジェクト: vip57884381/Paint.Net
        /// <summary>
        /// Checks if the build is expired, and displays a dialog box that takes the user to
        /// the Paint.NET website if necessary.
        /// </summary>
        /// <returns>true if the user should be allowed to continue, false if the build has expired</returns>
        public static bool HandleExpiration(IWin32Window owner)
        {
            if (IsExpired)
            {
                string expiredMessage = PdnResources.GetString("ExpiredDialog.Message");

                DialogResult result = MessageBox.Show(expiredMessage, PdnInfo.GetProductName(true),
                                                      MessageBoxButtons.OKCancel);

                if (result == DialogResult.OK)
                {
                    string expiredRedirect = InvariantStrings.ExpiredPage;
                    PdnInfo.LaunchWebSite(owner, expiredRedirect);
                }

                return(false);
            }

            return(true);
        }