From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 HMI.UI/MaskControl.xaml.cs |   64 ++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/HMI.UI/MaskControl.xaml.cs b/HMI.UI/MaskControl.xaml.cs
new file mode 100644
index 0000000..66fc8fd
--- /dev/null
+++ b/HMI.UI/MaskControl.xaml.cs
@@ -0,0 +1,64 @@
+锘縰sing HMI.Core.Util;
+using System;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace HMI.UI
+{
+    /// <summary>
+    /// MaskControl.xaml 鐨勪氦浜掗�昏緫
+    /// </summary>
+    public partial class MaskControl : UserControl
+    {
+        public static MaskControl Instance;
+
+        public static MaskControl GetInstance()
+        {
+            if (Instance == null)
+            {
+                Instance = new MaskControl();
+            }
+            return Instance;
+        }
+
+        public MaskControl()
+        {
+            InitializeComponent();
+        }
+
+        private void pausePanel_Loaded(object sender, RoutedEventArgs e)
+        {
+            var can = pausePanel;
+            var modal = visualModal;
+            Canvas.SetLeft(modal, (pausePanel.ActualWidth - visualModal.ActualWidth) / 2);
+            Canvas.SetTop(modal, (pausePanel.ActualHeight - visualModal.ActualHeight) / 2.5);
+        }
+
+        public void ShowMask(UserControl control, Action action, Action<Exception> reject = null, string title = null, string content = null)
+        {
+            this.titleLabel.Content = title ?? LangUtil.Get("App.PleaseWait");
+            this.contentLabel.Text = content;
+            pausePanel.Visibility = Visibility.Visible;
+            Task.Run(() =>
+            {
+                try
+                {
+                    action();
+                }
+                catch (Exception ex)
+                {
+                    if (reject != null) reject(ex);
+                }
+                finally
+                {
+                    Dispatcher.BeginInvoke(new Action(() =>
+                    {
+                        pausePanel.Visibility = Visibility.Collapsed;
+                    }));
+                }
+            });
+        }
+
+    }
+}

--
Gitblit v1.9.1