/// <summary> /// Create the upgrade dialog based on releaseNotesUri and updateOption /// </summary> private UpdateContainedDialog CreateUpgradeDialog(Uri releaseNotesUri, AutoUpdateOption updateOption) { UpdateContainedDialog dialog = new UpdateContainedDialog(releaseNotesUri); if (updateOption == AutoUpdateOption.RequiredUpgrade) { dialog.SetModeToRequired(); } AllowFurtherAction = false; return(dialog); }
private async void ShowUpgradeDialog() { // Make the upgrade decision var autoUpdate = Container.GetDefaultInstance().AutoUpdate; if (!ShouldUserUpgrade(autoUpdate, out _updateOption)) { return; } // Create the upgrade dialog UpdateContainedDialog dialog = CreateUpgradeDialog(autoUpdate.ReleaseNotesUri, _updateOption); bool?dialogResult = await ctrlDialogContainer.ShowDialog(dialog).ConfigureAwait(true); // user clicked update now (true) if (dialogResult.HasValue && dialogResult.Value) { try { DownLoadInstaller(autoUpdate); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { e.ReportException(); } #pragma warning restore CA1031 // Do not catch general exception types } else { // user clicked later (false) Logger.PublishTelemetryEvent(TelemetryEventFactory.ForUpgradeDismissed(autoUpdate.InstalledVersion)); } this.modeGrid.Opacity = 1; this.AllowFurtherAction = true; }