Added hack to show window if open (#4428)

This commit is contained in:
Arjun Balgovind 2020-06-22 15:38:55 -07:00 committed by GitHub
parent f6d53bc337
commit 87f0fcfd52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -7,7 +7,7 @@
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
mc:Ignorable="d"
Title="PowerToys Settings" Height="800" Width="1000">
Title="PowerToys Settings" Height="800" Width="1000" Closing="MainWindow_Closing">
<Grid>
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Views.ShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
</Grid>

View File

@ -15,6 +15,8 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
// Interaction logic for MainWindow.xaml.
public partial class MainWindow : Window
{
private bool isOpen = true;
public MainWindow()
{
var bootTime = new System.Diagnostics.Stopwatch();
@ -52,6 +54,17 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
shellPage.SetIsUserAnAdmin(Program.IsUserAnAdmin);
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
if (isOpen)
{
Show();
}
}
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
isOpen = false;
}
}
}