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; } }
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; } }
private void CheckForUpdate(IAutoUpdaterClient client) { if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled) { autoUpdater.CheckForUpdate().ContinueWith(updateInfo => { if (updateInfo.Result.HasUpdate) { client.UpdateAvailable(updateInfo.Result.VersionInfo); } }); } }
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); } }