private void CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker(Links.URL_UPDATE, Application.ProductName, Program.AssemblyVersion,
                                                            ReleaseChannelType.Stable, Uploader.ProxyInfo.GetWebProxy());

            updateChecker.CheckUpdate();

            if (updateChecker.UpdateInfo != null)
            {
                switch (updateChecker.UpdateInfo.Status)
                {
                case UpdateStatus.UpdateRequired:
                    string updateText = string.Format("Would you like to download the update?\r\n\r\n{0} is current version.\r\n{1} is latest version.",
                                                      updateChecker.UpdateInfo.CurrentVersion, updateChecker.UpdateInfo.LatestVersion);

                    if (MessageBox.Show(updateText, "ShareX update is available", MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        UpdaterForm downloader = new UpdaterForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                        downloader.ShowDialog();
                        if (downloader.Status == DownloaderFormStatus.InstallStarted)
                        {
                            Application.Exit();
                        }
                    }
                    break;

                case UpdateStatus.UpdateCheckFailed:
                    DebugHelper.WriteLine("Update check failed.");
                    break;
                }
            }
        }
Exemple #2
0
 private void navBarItem0705_LinkClicked(object sender, NavBarLinkEventArgs e)
 {
     using (var updaterForm = new UpdaterForm())
     {
         updaterForm.ShowDialog();
     }
 }
 private void llblUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (updateChecker != null && updateChecker.UpdateInfo != null && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
     {
         UpdaterForm downloader = new UpdaterForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
         downloader.ShowDialog();
         if (downloader.Status == DownloaderFormStatus.InstallStarted)
         {
             Application.Exit();
         }
     }
 }
Exemple #4
0
        private void NotifyUpdate(UpdateReleaseDetails details)
        {
            var file = Path.Combine(Path.GetTempPath(), details.FileName);

            using (var dialog = new UpdaterForm(details, file))
            {
                dialog.ShowDialog(this);
                if (dialog.Completed)
                {
                    _updateExecutable = file;
                    Close();
                }
            }
        }
Exemple #5
0
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = TaskHelpers.CheckUpdate();

            if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateAvailable &&
                MessageBox.Show("An update is available for ShareX.\r\nWould you like to download it?", "ShareX",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                UpdaterForm updaterForm = new UpdaterForm(updateChecker);
                updaterForm.ShowDialog();

                if (updaterForm.Status == DownloaderFormStatus.InstallStarted)
                {
                    Application.Exit();
                }
            }
        }
        private void ShowUpdateForm(IAppCast currentItem)
        {
            UpdaterForm updaterForm = new UpdaterForm(currentItem) { TopMost = true };
            DialogResult dialogResult = updaterForm.ShowDialog();

            if (dialogResult.Equals(DialogResult.Yes))
            {
                InitDownloadAndInstallProcess(currentItem);
            }
        }
Exemple #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FileConfig.ReadFile();
            try
            {
                try
                {
                    if (FileConfig.config.updateapi != "")
                    {
                        Updater.checkversion();
                        if (Updater.ready.Count() > 0)
                        {
                            DialogResult dlr = MessageBox.Show("Sẵn sàng cho cật nhập", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                            if (dlr == DialogResult.OK)
                            {
                                UpdaterForm upd = new UpdaterForm();
                                upd.ShowDialog();
                                return;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                if (!FileConfig.config.connectsuccess)
                {
                    CommonForm cf = new CommonForm();
                    cf.signal = 0;
                    Application.Run(cf);
                }
                else if (FileConfig.config.connectsuccess)
                {
                    using (var context = new ControllerModel())
                    {
                        if (context.Database.Exists())
                        {
                            if (!UserController.countUser())
                            {
                                CommonForm cf = new CommonForm();
                                cf.signal = 1;
                                Application.Run(cf);
                            }
                        }
                        else
                        {
                            BackupFile buf = new BackupFile();
                            buf.ShowDialog();
                        }
                    }

                    Application.Run(new LoginForm());
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
                BackupFile buf = new BackupFile();
                buf.ShowDialog();
            }
        }