mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[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:
@@ -179,13 +179,25 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
// Window is also needed to show MessageDialog
|
// Window is also needed to show MessageDialog
|
||||||
settingsWindow = new MainWindow(isDark);
|
settingsWindow = new MainWindow(isDark);
|
||||||
settingsWindow.Activate();
|
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");
|
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)
|
private async void ShowMessageDialog(string content, string title = null)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
await ShowDialogAsync(content, title);
|
await ShowDialogAsync(content, title);
|
||||||
|
#if !DEBUG
|
||||||
|
this.Exit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task<IUICommand> ShowDialogAsync(string content, string title = null)
|
public static Task<IUICommand> ShowDialogAsync(string content, string title = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user