예제 #1
0
        private void AutoCheckUpdate()
        {
            if (Program.Config.AutoCheckUpdate)
            {
                Thread updateThread = new Thread(() =>
                {
                    UpdateChecker updateChecker = AboutForm.CheckUpdate();

                    if (updateChecker != null && updateChecker.Status == ShareX.HelpersLib.UpdateStatus.UpdateAvailable &&
                        MessageBox.Show(Resources.MainWindow_CheckUpdate_,
                                        string.Format("{0} {1} is available", Application.ProductName, updateChecker.LatestVersion),
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        using (DownloaderForm updaterForm = new DownloaderForm(updateChecker))
                        {
                            updaterForm.ShowDialog();

                            if (updaterForm.Status == DownloaderFormStatus.InstallStarted)
                            {
                                Application.Exit();
                            }
                        }
                    }
                });
                updateThread.IsBackground = true;
                updateThread.Start();
            }
        }
예제 #2
0
        private void CheckUpdate()
        {
            if (UpdaterAck != System.Windows.Forms.DialogResult.None)
            {
                UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Adapter.AssemblyVersion),
                                                                Engine.ConfigUI.ReleaseChannel, Uploader.ProxySettings.GetWebProxy);
                updateChecker.CheckUpdate();
                UpdaterAck = System.Windows.Forms.DialogResult.None;

                if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
                {
                    UpdaterAck = MessageBox.Show("Update found. Do you want to download it?", Application.ProductName, MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (UpdaterAck == DialogResult.Yes)
                    {
                        DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                        downloader.ShowDialog();
                        if (downloader.Status == DownloaderFormStatus.InstallStarted)
                        {
                            Application.Exit();
                        }
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Open the download window and download the Tycho catalog
 /// </summary>
 /// <param name="sender">object sender</param>
 /// <param name="e">event arguments</param>
 /// <remarks>The parameters <paramref name="sender"/> and <paramref name="e"/> are not needed, but must be indicated.</remarks>
 private void ButtonDownloadTychoCatalog_Click(object sender, EventArgs e)
 {
     settings.Reload();
     using (DownloaderForm downloaderForm = new DownloaderForm())
     {
         downloaderForm.SetHost(host: settings.UserHostName);
         downloaderForm.SetHostUrls(files: filesTychoCatalog);
         downloaderForm.SetCatalogDirectory(directory: settings.UserTychoCatalogDirectory);
         downloaderForm.ShowDialog();
     }
 }
예제 #4
0
 private void llblUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (updateChecker != null && updateChecker.UpdateInfo != null && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
     {
         DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
         downloader.ShowDialog();
         if (downloader.Status == DownloaderFormStatus.InstallStarted)
         {
             Application.Exit();
         }
     }
 }
예제 #5
0
        public static DialogResult DownloadFFmpeg(bool async, DownloaderForm.DownloaderInstallEventHandler installRequested)
        {
            FFmpegUpdateChecker updateChecker = new FFmpegUpdateChecker("ShareX", "FFmpeg");
            string url = updateChecker.GetLatestDownloadURL(true);

            using (DownloaderForm form = new DownloaderForm(url, "ffmpeg.zip"))
            {
                form.Proxy       = HelpersOptions.CurrentProxy.GetWebProxy();
                form.InstallType = InstallType.Event;
                form.RunInstallerInBackground = async;
                form.InstallRequested        += installRequested;
                return(form.ShowDialog());
            }
        }
예제 #6
0
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = TaskHelpers.CheckUpdate();

            if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateAvailable &&
                MessageBox.Show("A newer version of ShareX is available.\r\nWould you like to download and install it?", string.Format("{0} v{1} is available", Application.ProductName, updateChecker.UpdateInfo.LatestVersion.ToString()),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                using (DownloaderForm updaterForm = new DownloaderForm(updateChecker))
                {
                    updaterForm.ShowDialog();

                    if (updaterForm.Status == DownloaderFormStatus.InstallStarted)
                    {
                        Application.Exit();
                    }
                }
            }
        }
예제 #7
0
        private void CheckUpdate()
        {
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Program.AssemblyVersion),
                                                            ReleaseChannelType.Stable, Uploader.ProxySettings.GetWebProxy);

            updateChecker.CheckUpdate();

            if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL))
            {
                if (MessageBox.Show("Update found. Do you want to download it?", "Update check", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary);
                    downloader.ShowDialog();
                    if (downloader.Status == DownloaderFormStatus.InstallStarted)
                    {
                        Application.Exit();
                    }
                }
            }
        }
예제 #8
0
        public static DialogResult DownloadFFmpeg(bool async, DownloaderForm.DownloaderInstallEventHandler installRequested)
        {
            string url;

            if (NativeMethods.Is64Bit())
            {
                url = "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.7z";
            }
            else
            {
                url = "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z";
            }

            using (DownloaderForm form = new DownloaderForm(url, "ffmpeg.7z"))
            {
                form.Proxy       = ProxyInfo.Current.GetWebProxy();
                form.InstallType = InstallType.Event;
                form.RunInstallerInBackground = async;
                form.InstallRequested        += installRequested;
                return(form.ShowDialog());
            }
        }