[Settings] Fix settings process not terminating on closing settings while minimized (#6626)

* Added code to set CoreWindow to visible on closing while minimized

* Changed to environment.exit
This commit is contained in:
Arjun Balgovind
2020-09-16 09:47:43 -07:00
committed by GitHub
parent 5b684cca9a
commit 5e301133ff

View File

@@ -80,7 +80,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
shellPage.Refresh();
}
// If the window is open, explicity force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384
// XAML Islands: If the window is open, explicity force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384
if (isOpen)
{
Show();
@@ -90,6 +90,13 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
isOpen = false;
// XAML Islands: If the window is closed while minimized, exit the process. Required to avoid process not terminating issue - https://github.com/microsoft/PowerToys/issues/4430
if (WindowState == WindowState.Minimized)
{
// Run Environment.Exit on a separate task to avoid performance impact
System.Threading.Tasks.Task.Run(() => { Environment.Exit(0); });
}
}
}
}