예제 #1
0
        /// <summary>
        ///     Look for updates while displaying a progress bar. At the end display a message box with the result.
        /// </summary>
        public static void LookForUpdates()
        {
            var result = UpdateSystem.UpdateStatus.CheckFailed;
            var error  = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleSearchingForUpdates,
                                                  x => { result = UpdateSystem.CheckForUpdates(); });

            if (error == null)
            {
                switch (result)
                {
                case UpdateSystem.UpdateStatus.CheckFailed:
                    MessageBoxes.UpdateFailed(UpdateSystem.LastError != null
                            ? UpdateSystem.LastError.Message
                            : "Unknown error");
                    break;

                case UpdateSystem.UpdateStatus.NewAvailable:
                    if (MessageBoxes.UpdateAskToDownload())
                    {
                        UpdateSystem.BeginUpdate();
                    }
                    break;

                case UpdateSystem.UpdateStatus.UpToDate:
                    MessageBoxes.UpdateUptodate();
                    break;
                }
            }
            else
            {
                MessageBoxes.UpdateFailed(error.Message);
            }
        }
예제 #2
0
        public static void AskAndBeginUpdate()
        {
            if (MessageBoxes.UpdateAskToDownload())
            {
                try
                {
                    // Prevent log cleaner from running in portable builds
                    EntryPoint.IsRestarting = true;

                    UpdateSystem.BeginUpdate();
                }
                catch (Exception ex)
                {
                    EntryPoint.IsRestarting = false;

                    Console.WriteLine(ex);
                    MessageBoxes.UpdateFailed(ex.Message);
                }
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     UpdateSystem.BeginUpdate();
 }