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.ParameterManage/TestItemModal.xaml.cs |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/HMI.ParameterManage/TestItemModal.xaml.cs b/HMI.ParameterManage/TestItemModal.xaml.cs
new file mode 100644
index 0000000..323a585
--- /dev/null
+++ b/HMI.ParameterManage/TestItemModal.xaml.cs
@@ -0,0 +1,114 @@
+锘縰sing HMI.Core.Entity;
+using HMI.Core.Util;
+using HMI.UI.DpUtil;
+using HMI.UI.Util;
+using Panuon.WPF.UI;
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+
+namespace HMI.ParameterManage
+{
+    /// <summary>
+    /// ModalWindow.xaml 鐨勪氦浜掗�昏緫
+    /// </summary>
+    public partial class TestItemModal : WindowX
+    {
+        public TestItemModal()
+        {
+            this.DataContext = this;
+            InitializeComponent();
+        }
+
+        public TestItemData Data { get; set; }
+        public ObservableCollection<TestItemData> Datasource { get; set; }
+
+        private bool _isProcessing;
+
+        protected override void OnClosing(CancelEventArgs e)
+        {
+            //Press Continue Button
+            if (DialogResult == true)
+            {
+                if (_isProcessing)
+                {
+                    e.Cancel = true;
+                    return;
+                }
+                var okButton = WindowXModalDialog.GetOKButton(this);
+                try
+                {
+                    _isProcessing = true;
+                    ButtonHelper.SetIsPending(okButton, true);
+                    if (!ValidateForm())
+                    {
+                        e.Cancel = true;
+                        return;
+                    }
+
+                    SaveOrUpdateParameter(Data);
+                }
+                catch (Exception ex)
+                {
+                    ToastHelper.Error(this, $"Error: {ex.Message}");
+                    e.Cancel = true;
+                    return;
+                }
+                finally
+                {
+                    _isProcessing = false;
+                    ButtonHelper.SetIsPending(okButton, false);
+                }
+            }
+            base.OnClosing(e);
+        }
+
+        public bool ValidateName(object value, out string err)
+        {
+            err = null;
+            if (Datasource?.FirstOrDefault(e => e.Name == value.ToString()) != null)
+            {
+                err = this.lang("App.MustBeUnique", this.lang("Pm.Parameter.Name"));
+                return false;
+            }
+            return true;
+        }
+
+        private void SaveOrUpdateParameter(TestItemData data)
+        {
+        }
+
+        private bool ValidateForm()
+        {
+            bool flag = FormGroupHelper.ValidateForm(formPanel);
+            if (flag)
+            {
+                Data.Name = TbName.Text;
+                Data.Type = CbType.Text;
+                Data.Enable = CoEnable.IsChecked == true;
+                Data.LimitDown = NiLimitDown.Value ?? 0;
+                Data.LimitUp = NiLimitUp.Value ?? 0;
+                Data.StrValue = TbStrValue.Text;
+                Data.Offset = NiOffset.Value ?? 0;
+                Data.Source = CbSource.Text;
+            }
+            return flag;
+        }
+
+        public bool? Open(TestItemData data, ObservableCollection<TestItemData> datasource)
+        {
+            Datasource = datasource;
+            Data = data;
+            TbName.Text = Data.Name;
+            CbType.Text = Data.Type;
+            CoEnable.IsChecked = Data.Enable;
+            NiLimitDown.Value = Data.LimitDown;
+            NiLimitUp.Value = Data.LimitUp;
+            TbStrValue.Text = Data.StrValue;
+            NiOffset.Value = Data.Offset;
+            CbSource.Text = Data.Source;
+            return this.ShowDialog();
+        }
+    }
+}

--
Gitblit v1.9.1