From c401a2f2fd1a509cdeb33e850bb5c2827074af48 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 17 三月 2025 08:44:51 +0800
Subject: [PATCH] 完善框架,新增两个close方法;

---
 HMI.UI/Util/MsgBoxHelper.cs |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/HMI.UI/Util/MsgBoxHelper.cs b/HMI.UI/Util/MsgBoxHelper.cs
index 8a20c3e..6d5d49d 100644
--- a/HMI.UI/Util/MsgBoxHelper.cs
+++ b/HMI.UI/Util/MsgBoxHelper.cs
@@ -8,7 +8,7 @@
     public class MsgBoxHelper
     {
         #region Warn
-        public static MessageBoxResult WarnMessage(Window owner,
+        public static MessageBoxResult WarnMessage(DependencyObject owner,
             string message,
             string caption = null,
             MessageBoxButton button = MessageBoxButton.OKCancel,
@@ -48,7 +48,7 @@
         #endregion
 
         #region Info
-        public static MessageBoxResult InfoMessage(Window owner,
+        public static MessageBoxResult InfoMessage(DependencyObject owner,
             string message,
             string caption = null,
             MessageBoxButton button = MessageBoxButton.OKCancel,
@@ -71,7 +71,7 @@
             MessageBoxResult res = MessageBoxResult.None;
             if (!(owner is Window window))
             {
-                window = Window.GetWindow(owner);
+                window = Window.GetWindow(owner) ?? Application.Current.MainWindow;
             }
             window.Dispatcher.Invoke(() =>
             {

--
Gitblit v1.9.1