From 5a0ad6e4f9d2f2c43fa9d5f8a9e238cd1be183c4 Mon Sep 17 00:00:00 2001 From: farb Date: Wed, 19 Jul 2023 01:02:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=9C=80=E5=B0=8F=E5=8C=96?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=8D=95=E5=87=BB=E6=89=98=E7=9B=98=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=97=B6=E5=BA=94=E8=AF=A5=E6=98=BE=E7=A4=BA=E4=B8=BB?= =?UTF-8?q?=E7=AA=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interactivity/Commands/PushMainWindow2TopCommand.cs | 6 +++--- src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/PushMainWindow2TopCommand.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/PushMainWindow2TopCommand.cs index aef166657..174c1fe64 100644 --- a/src/Shared/HandyControl_Shared/Interactivity/Commands/PushMainWindow2TopCommand.cs +++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/PushMainWindow2TopCommand.cs @@ -11,10 +11,10 @@ public class PushMainWindow2TopCommand : ICommand public void Execute(object parameter) { - if (Application.Current.MainWindow != null && Application.Current.MainWindow.Visibility != Visibility.Visible) + Window mainWindow = Application.Current.MainWindow; + if (mainWindow != null && mainWindow.Visibility != Visibility.Visible || mainWindow.WindowState == WindowState.Minimized) { - Application.Current.MainWindow.Show(); - WindowHelper.SetWindowToForeground(Application.Current.MainWindow); + WindowHelper.SetWindowToForeground(mainWindow); } } diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs index 6bab0d0d9..81e9c9646 100644 --- a/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs +++ b/src/Shared/HandyControl_Shared/Tools/Helper/WindowHelper.cs @@ -195,6 +195,7 @@ public static void SetWindowToForeground(Window window) window.Topmost = true; window.Topmost = false; } + window.WindowState = WindowState.Normal; } ///