[UI] Fix Settings-window doesn't show back up when minimized in taskbar by user#484
Conversation
…kbar 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
|
https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.activate?view=net-5.0 refer this, it will call a SetForeGround invoke (which is a pinvoke I learnt in WindowWalker plugin), so it will set specific window. Question, do we need to set the windows' state? or calling Activate will be fine? |
Lemme quick test that, see if it works without Activate() |
Yes, seems that without Activate() still works, I think we can remove that line |
|
If we don't |
Interesting, I finally understand why sometimes windowwalker won't actually show up the window. |
|
Could you change the comment for Activate()? |
|
Done! |
Ha🤔 Does Activate don't need to be included? Could you give it a quick test? |
Tested, still works without Activate, I'm to not sure why 😅 I tried remove |
If setting window is not minimized, but simply hided by other window, it may not work I guess. Though, I am not sure whether Focus can replace the need for Activate. |
|
Could you give that a quick test? |
Just tested, you're right! Remove But, still remove Seems that we can use either Any more test case that I can run? 😄 |
|
I guess that's enough. Thank you for testing! If Focus work, we can remove Activate(). Would you please remove one extra empty line? I think one is fine for separating the logic. Then, I will approve, and merge later to let somebody else to review if they want. Thank you for the fix. |
Like this? I tend to go overboard on whitespaces haha |
|
Yes, thank you! |

Bug reproduce steps:
I'm not really sure why this solution works tho 😅
Maybe
.Show()fails whenwindow.WindowState == Minimized(notNormal)Not sure why need .Activate() too
Ref: https://stackoverflow.com/a/59719760/4230390
Please delete unnecessary comments if this is too obvious to C# devs 😅