private async Task <bool> HandleReleaseSwitch() { var channelDialog = new ChangeChannelContainedDialog(appSettingsCtrl.SelectedReleaseChannel); if (appSettingsCtrl.SelectedReleaseChannel == Configuration.ReleaseChannel || !await MainWin.ctrlDialogContainer.ShowDialog(channelDialog).ConfigureAwait(false)) { return(false); } try { VersionSwitcherWrapper.ChangeChannel(appSettingsCtrl.SelectedReleaseChannel); Dispatcher.Invoke(() => MainWin.Close()); return(true); } catch (Exception ex) { ex.ReportException(); Dispatcher.Invoke(() => MessageDialog.Show(string.Format(CultureInfo.InvariantCulture, Properties.Resources.ConfigurationModeControl_VersionSwitcherException)) ); } return(false); }
private async Task <bool> HandleReleaseSwitch() { if (appSettingsCtrl.SelectedReleaseChannel == Configuration.ReleaseChannel) { return(false); } Logger.PublishTelemetryEvent(TelemetryEventFactory.ForReleaseChannelChangeConsidered( Configuration.ReleaseChannel, appSettingsCtrl.SelectedReleaseChannel)); var channelDialog = new ChangeChannelContainedDialog(appSettingsCtrl.SelectedReleaseChannel); if (!await MainWin.ctrlDialogContainer.ShowDialog(channelDialog).ConfigureAwait(false)) { return(false); } // If the window is topmost, the UAC prompt from the version switcher will appear behind the main window. // To prevent this, save the previous topmost state, ensure that the main window is not topmost when the // UAC prompt will display, then restore the previous topmost state. bool previousTopmostSetting = Configuration.AlwaysOnTop; try { Dispatcher.Invoke(() => { previousTopmostSetting = MainWin.Topmost; MainWin.Topmost = false; }); VersionSwitcherWrapper.ChangeChannel(appSettingsCtrl.SelectedReleaseChannel); Dispatcher.Invoke(() => MainWin.Close()); return(true); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) { ex.ReportException(); Dispatcher.Invoke(() => { MainWin.Topmost = previousTopmostSetting; MessageDialog.Show(Properties.Resources.ConfigurationModeControl_VersionSwitcherException); }); return(false); } #pragma warning restore CA1031 // Do not catch general exception types }
public MainWindow() { InitializeComponent(); new WorkerList().Show(); MainWin.Close(); }
private void CloseWindow(object sender, RoutedEventArgs e) { //MainWin.CloseWindow(sender, e); MainWin.Close(); }