Ejemplo n.º 1
0
 private void CheckForUpdates()
 {
     if (checkForUpdates)
     {
         if (Updater.NewVersionExists(currentVersion))
         {
             if (!autoUpdate)
             {
                 UpdateAvailable frmUpdateAvailable = new UpdateAvailable();
                 System.Windows.Forms.DialogResult result = frmUpdateAvailable.ShowDialog();
                 autoUpdate = frmUpdateAvailable.dontAskAgain;
                 if (frmUpdateAvailable.dontAskAgain)
                 {
                     checkForUpdates = (result == System.Windows.Forms.DialogResult.Yes);
                 }
                 if (result == System.Windows.Forms.DialogResult.Yes)
                 {
                     Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\CTToolUpdater.exe");
                     this.Close();
                 }
             }
             else
             {
                 //Prevent auto update if last try less than 5 minutes.
                 //Prevents consecutive auto trys if it fails to update
                 if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\version.txt"))
                 {
                     if (System.IO.File.GetLastWriteTime(AppDomain.CurrentDomain.BaseDirectory + @"\version.txt") + new TimeSpan(0, 5, 0) < DateTime.Now)
                     {
                         Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\CTToolUpdater.exe");
                         this.Close();
                     }
                 }
                 else
                 {
                     Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\CTToolUpdater.exe");
                     this.Close();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void CheckNewVersion()
        {
            lbl_status.Text = "Checking new version......";
            this.Cursor = Cursors.WaitCursor;
            bool bNeedUpdate = Updater.NewVersionExists(currentVersion);
            this.Cursor = Cursors.Default;
            lbl_status.Text = "";
            if (bNeedUpdate)
            {
                UpdateAvailable frmUpdateAvailable = new UpdateAvailable();
                System.Windows.Forms.DialogResult result = frmUpdateAvailable.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\CTToolUpdater.exe");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(lang.getLangStr("CT_upgrade"), "Info", MessageBoxButtons.OK); return;
            }
        }