示例#1
0
        public static void Start(UpdateChecker updateChecker, bool activateWindow = true)
        {
            if (updateChecker != null && updateChecker.Status == UpdateStatus.UpdateAvailable)
            {
                IsOpen = true;

                try
                {
                    DialogResult result;

                    using (UpdateMessageBox messageBox = new UpdateMessageBox())
                    {
                        messageBox.ActivateWindow = activateWindow;
                        result = messageBox.ShowDialog();
                    }

                    if (result == DialogResult.Yes)
                    {
                        using (DownloaderForm updaterForm = new DownloaderForm(updateChecker))
                        {
                            updaterForm.ShowDialog();

                            if (updaterForm.Status == DownloaderFormStatus.InstallStarted)
                            {
                                Application.Exit();
                            }
                        }
                    }
                }
                finally
                {
                    IsOpen = false;
                }
            }
        }
示例#2
0
        public static DialogResult Start(UpdateChecker updateChecker, bool activateWindow = true)
        {
            DialogResult result = DialogResult.None;

            if (updateChecker != null && updateChecker.Status == UpdateStatus.UpdateAvailable)
            {
                IsOpen = true;

                try
                {
                    using (UpdateMessageBox messageBox = new UpdateMessageBox(activateWindow, updateChecker.IsPortable))
                    {
                        result = messageBox.ShowDialog();
                    }

                    if (result == DialogResult.Yes)
                    {
                        updateChecker.DownloadUpdate();
                    }
                }
                finally
                {
                    IsOpen = false;
                }
            }

            return result;
        }
示例#3
0
        public DownloaderForm(UpdateChecker updateChecker) : this(updateChecker.DownloadURL, updateChecker.Filename)
        {
            Proxy = updateChecker.Proxy;

            if (updateChecker is GitHubUpdateChecker)
            {
                AcceptHeader = "application/octet-stream";
            }
        }
示例#4
0
        private void CheckingUpdate(CheckUpdate checkUpdate)
        {
            updateChecker = checkUpdate();

            try
            {
                UpdateControls();
            }
            catch
            {
            }

            isBusy = false;
        }
示例#5
0
        public void CheckUpdate(UpdateChecker updateChecker)
        {
            if (!IsBusy)
            {
                IsBusy = true;

                this.updateChecker = updateChecker;

                lblStatus.Visible = false;
                llblUpdateAvailable.Visible = false;

                pbLoading.Visible = true;
                lblCheckingUpdates.Visible = true;

                Thread thread = new Thread(CheckingUpdate);
                thread.IsBackground = true;
                thread.Start();
            }
        }
示例#6
0
 private void CheckingUpdate(CheckUpdate checkUpdate)
 {
     updateChecker = checkUpdate();
     UpdateControls();
     isBusy = false;
 }