From b544d5cccd76735e034c8055918a50927b437474 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期二, 10 十一月 2026 08:29:04 +0800
Subject: [PATCH] fix: 维护模式重复进入失败与按钮灰死 + Broker 并发验证用例

---
 HMI.UI/Util/MsgBoxHelper.cs |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/HMI.UI/Util/MsgBoxHelper.cs b/HMI.UI/Util/MsgBoxHelper.cs
index 6d5d49d..2c81478 100644
--- a/HMI.UI/Util/MsgBoxHelper.cs
+++ b/HMI.UI/Util/MsgBoxHelper.cs
@@ -2,6 +2,7 @@
 using System.Windows;
 using Panuon.WPF.UI.Configurations;
 using HMI.Core.Util;
+using System;
 
 namespace HMI.UI.Util
 {
@@ -71,12 +72,22 @@
             MessageBoxResult res = MessageBoxResult.None;
             if (!(owner is Window window))
             {
-                window = Window.GetWindow(owner) ?? Application.Current.MainWindow;
+                owner.Dispatcher.Invoke(() =>
+                {
+                    window = Window.GetWindow(owner) ?? Application.Current.MainWindow;
+                    window.Dispatcher.Invoke(() =>
+                    {
+                        res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
+                    });
+                });
             }
-            window.Dispatcher.Invoke(() =>
+            else
             {
-                res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
-            });
+                window.Dispatcher.Invoke(() =>
+                {
+                    res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
+                });
+            }
             return res;
         }
     }

--
Gitblit v1.9.1