예제 #1
0
        public void PerformUpdate(IAutoUpdaterClient client, VersionInfo versionInfo)
        {
            switch (formFactory.Create <FUpdate>().ShowDialog())
            {
            case DialogResult.Yes:     // Install
                // TODO: The app process might need to be killed/restarted before/after installing
                autoUpdater.DownloadAndInstallUpdate(versionInfo).ContinueWith(result =>
                {
                    if (result.Result)
                    {
                        client.InstallComplete();
                    }
                    else
                    {
                        MessageBox.Show(MiscResources.InstallFailed, MiscResources.InstallFailedTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                });
                break;

            case DialogResult.OK:     // Download
                var saveDialog = new SaveFileDialog
                {
                    FileName = versionInfo.FileName
                };
                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    // TODO: Display progress while downloading
                    autoUpdater.DownloadUpdate(versionInfo, saveDialog.FileName);
                }
                break;
            }
        }
예제 #2
0
 public void PerformUpdate(IAutoUpdaterClient client, VersionInfo versionInfo)
 {
     switch (formFactory.Create<FUpdate>().ShowDialog())
     {
         case DialogResult.Yes: // Install
             // TODO: The app process might need to be killed/restarted before/after installing
             autoUpdater.DownloadAndInstallUpdate(versionInfo).ContinueWith(result =>
             {
                 if (result.Result)
                 {
                     client.InstallComplete();
                 }
                 else
                 {
                     MessageBox.Show(MiscResources.InstallFailed, MiscResources.InstallFailedTitle,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             });
             break;
         case DialogResult.OK: // Download
             var saveDialog = new SaveFileDialog
             {
                 FileName = versionInfo.FileName
             };
             if (saveDialog.ShowDialog() == DialogResult.OK)
             {
                 // TODO: Display progress while downloading
                 autoUpdater.DownloadUpdate(versionInfo, saveDialog.FileName);
             }
             break;
     }
 }
예제 #3
0
 private void CheckForUpdate(IAutoUpdaterClient client)
 {
     if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled)
     {
         autoUpdater.CheckForUpdate().ContinueWith(updateInfo =>
         {
             if (updateInfo.Result.HasUpdate)
             {
                 client.UpdateAvailable(updateInfo.Result.VersionInfo);
             }
         });
     }
 }
예제 #4
0
 public void OnApplicationStart(IAutoUpdaterClient client)
 {
     if (userConfigManager.Config.LastUpdateCheckDate == null)
     {
         userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
         userConfigManager.Save();
     }
     if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval)
     {
         PromptToEnableAutomaticUpdates();
         CheckForUpdate(client);
     }
 }
예제 #5
0
 private void CheckForUpdate(IAutoUpdaterClient client)
 {
     if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled)
     {
         autoUpdater.CheckForUpdate().ContinueWith(updateInfo =>
         {
             if (updateInfo.Result.HasUpdate)
             {
                 client.UpdateAvailable(updateInfo.Result.VersionInfo);
             }
         });
     }
 }
예제 #6
0
 public void OnApplicationStart(IAutoUpdaterClient client)
 {
     if (userConfigManager.Config.LastUpdateCheckDate == null)
     {
         userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
         userConfigManager.Save();
     }
     if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval)
     {
         PromptToEnableAutomaticUpdates();
         CheckForUpdate(client);
     }
 }