Пример #1
0
        public DownloaderForm(UpdateChecker updateChecker)
            : this(updateChecker.DownloadURL, updateChecker.Filename)
        {
            Proxy = updateChecker.Proxy;

            if (updateChecker is GitHubUpdateChecker)
            {
                AcceptHeader = "application/octet-stream";
            }
        }
Пример #2
0
        private void CheckingUpdate(CheckUpdate checkUpdate)
        {
            updateChecker = checkUpdate();

            try
            {
                UpdateControls();
            }
            catch
            {
            }

            isBusy = false;
        }
Пример #3
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;
                }
            }
        }