From 2e54b439c64e0adbb7e010243c1f33aa5fc5f503 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 11 三月 2025 14:08:57 +0800
Subject: [PATCH] 完善程序; Merge branch 'master' of http://58.211.88.246:3600/r/WPF/WPFProject
---
HMI.UI/Util/MsgBoxHelper.cs | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/HMI.UI/Util/MsgBoxHelper.cs b/HMI.UI/Util/MsgBoxHelper.cs
index 496b435..047e96a 100644
--- a/HMI.UI/Util/MsgBoxHelper.cs
+++ b/HMI.UI/Util/MsgBoxHelper.cs
@@ -1,7 +1,6 @@
锘縰sing Panuon.WPF.UI;
using System.Windows;
using Panuon.WPF.UI.Configurations;
-using System.Windows.Threading;
namespace HMI.UI.Util
{
@@ -65,17 +64,13 @@
DefaultButton defaultButton, MessageBoxXSetting setting, int? countdown)
{
MessageBoxResult res = MessageBoxResult.None;
- Application.Current.Dispatcher.Invoke(() =>
+ if (!(owner is Window window))
{
- if (owner is Window window)
- {
- res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
- }
- else
- {
- window = Window.GetWindow(owner);
- res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
- }
+ window = Window.GetWindow(owner);
+ }
+ window.Dispatcher.Invoke(() =>
+ {
+ res = MessageBoxX.Show(window, message, caption, button, icon, defaultButton, setting, countdown);
});
return res;
}
--
Gitblit v1.9.1