From d3384bf67745d5d51a0019f6dd1409f0f5b885a6 Mon Sep 17 00:00:00 2001 From: pc223 <10551242+pc223@users.noreply.github.com> Date: Tue, 22 Jun 2021 17:46:01 +0700 Subject: [PATCH 1/3] [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 --- Flow.Launcher/Helper/SingletonWindowOpener.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Flow.Launcher/Helper/SingletonWindowOpener.cs b/Flow.Launcher/Helper/SingletonWindowOpener.cs index 3671b9fd307..b969abcb476 100644 --- a/Flow.Launcher/Helper/SingletonWindowOpener.cs +++ b/Flow.Launcher/Helper/SingletonWindowOpener.cs @@ -11,7 +11,19 @@ public static T Open(params object[] args) where T : Window var window = Application.Current.Windows.OfType().FirstOrDefault(x => x.GetType() == typeof(T)) ?? (T)Activator.CreateInstance(typeof(T), args); Application.Current.MainWindow.Hide(); + + + // Fix UI bug + // If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar + // Not sure why this works tho + // Probably because, when `.Show()` failed, `window.WindowState == Minimized` (not `Normal`) + // https://stackoverflow.com/a/59719760/4230390 + // Not sure why need .Activate() too + window.WindowState = WindowState.Normal; window.Show(); + window.Activate(); + + window.Focus(); return (T)window; From 43257ea9cf5655c6c11cdc70e2eec5cb8cb15b20 Mon Sep 17 00:00:00 2001 From: pc223 <10551242+pc223@users.noreply.github.com> Date: Tue, 22 Jun 2021 23:28:21 +0700 Subject: [PATCH 2/3] Remove .Activate() --- Flow.Launcher/Helper/SingletonWindowOpener.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Helper/SingletonWindowOpener.cs b/Flow.Launcher/Helper/SingletonWindowOpener.cs index b969abcb476..3b2b3631df0 100644 --- a/Flow.Launcher/Helper/SingletonWindowOpener.cs +++ b/Flow.Launcher/Helper/SingletonWindowOpener.cs @@ -14,14 +14,13 @@ public static T Open(params object[] args) where T : Window // Fix UI bug + // Add `window.WindowState = WindowState.Normal` // If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar // Not sure why this works tho - // Probably because, when `.Show()` failed, `window.WindowState == Minimized` (not `Normal`) + // Probably because, when `.Show()` fails, `window.WindowState == Minimized` (not `Normal`) // https://stackoverflow.com/a/59719760/4230390 - // Not sure why need .Activate() too window.WindowState = WindowState.Normal; window.Show(); - window.Activate(); window.Focus(); From 18b889c621c1a1bf24dd61381fa5aea96f7040b2 Mon Sep 17 00:00:00 2001 From: pc223 <10551242+pc223@users.noreply.github.com> Date: Wed, 23 Jun 2021 00:11:54 +0700 Subject: [PATCH 3/3] Remove empty lines --- Flow.Launcher/Helper/SingletonWindowOpener.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Flow.Launcher/Helper/SingletonWindowOpener.cs b/Flow.Launcher/Helper/SingletonWindowOpener.cs index 3b2b3631df0..fdfaaa4fc7e 100644 --- a/Flow.Launcher/Helper/SingletonWindowOpener.cs +++ b/Flow.Launcher/Helper/SingletonWindowOpener.cs @@ -12,7 +12,6 @@ public static T Open(params object[] args) where T : Window ?? (T)Activator.CreateInstance(typeof(T), args); Application.Current.MainWindow.Hide(); - // Fix UI bug // Add `window.WindowState = WindowState.Normal` // If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar @@ -22,7 +21,6 @@ public static T Open(params object[] args) where T : Window window.WindowState = WindowState.Normal; window.Show(); - window.Focus(); return (T)window;