[Settings] Close Settings app if running as standalone process after showing message dialog (#19620)

... in Release mode
In Debug mode leave settings app running after closing message dialog
This commit is contained in:
Stefan Markovic
2022-07-27 12:39:31 +02:00
committed by GitHub
parent 7f6c91e166
commit da9c2b649b

View File

@@ -179,13 +179,25 @@ namespace Microsoft.PowerToys.Settings.UI
// Window is also needed to show MessageDialog
settingsWindow = new MainWindow(isDark);
settingsWindow.Activate();
#if !DEBUG
ShowMessageDialogAndExit("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden");
#else
ShowMessageDialog("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden");
#endif
}
}
#if !DEBUG
private async void ShowMessageDialogAndExit(string content, string title = null)
#else
private async void ShowMessageDialog(string content, string title = null)
#endif
{
await ShowDialogAsync(content, title);
#if !DEBUG
this.Exit();
#endif
}
public static Task<IUICommand> ShowDialogAsync(string content, string title = null)