Skip to content

Commit d3384bf

Browse files
committed
[UI] Fix Settings-window doesn't show back up when minimized in taskbar by user
Not sure why this works tho Maybe `.Show()` failed when `window.WindowState == Minimized` (not `Normal`) Not sure why need .Activate() too Ref: https://stackoverflow.com/a/59719760/4230390
1 parent 9fc97c6 commit d3384bf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Flow.Launcher/Helper/SingletonWindowOpener.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ public static T Open<T>(params object[] args) where T : Window
1111
var window = Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.GetType() == typeof(T))
1212
?? (T)Activator.CreateInstance(typeof(T), args);
1313
Application.Current.MainWindow.Hide();
14+
15+
16+
// Fix UI bug
17+
// If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar
18+
// Not sure why this works tho
19+
// Probably because, when `.Show()` failed, `window.WindowState == Minimized` (not `Normal`)
20+
// https://stackoverflow.com/a/59719760/4230390
21+
// Not sure why need .Activate() too
22+
window.WindowState = WindowState.Normal;
1423
window.Show();
24+
window.Activate();
25+
26+
1527
window.Focus();
1628

1729
return (T)window;

0 commit comments

Comments
 (0)