From 006c98e5650b530e5220f279c1e803fefe69d40d Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 25 十一月 2025 15:47:33 +0800
Subject: [PATCH] 优化一些东西;

---
 HMI.ParameterManage/ParameterModal.xaml.cs |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/HMI.ParameterManage/ParameterModal.xaml.cs b/HMI.ParameterManage/ParameterModal.xaml.cs
index 854380e..d7553d4 100644
--- a/HMI.ParameterManage/ParameterModal.xaml.cs
+++ b/HMI.ParameterManage/ParameterModal.xaml.cs
@@ -73,9 +73,10 @@
 
         private bool ValidateForm()
         {
-            bool flag = FormGroupHelper.ValidateForm(formPanel, new Dictionary<string, object> {
+            var cache = new Dictionary<string, object> {
                 { "FgValue",GetTargetValue()}
-            });
+            };
+            bool flag = FormGroupHelper.ValidateForm(formPanel, cache);
             if (flag)
             {
                 Data.Name = TbName.Text;
@@ -84,32 +85,34 @@
                 Data.Unit = TbUnit.Text;
                 Data.Description = TbDescription.Text;
                 Data.ProductName = TbProductName.Text;
-                Data.PGroup = TbPGroup.Text;
+                Data.PGroup = CbGroup.Text;
             }
             return flag;
         }
 
-        public bool? Open(string productName, ParameterData data)
+        public bool? Open(string productName, ParameterData data, List<string> groups)
         {
             Data = data;
             TbName.Text = Data.Name;
             CbType.SelectedValue = Data.Type;
+            CbGroup.ItemsSource = groups;
             UpdateWindow(Data.Type);
             UpdateForm(Data);
             TbUnit.Text = Data.Unit;
             TbProductName.Text = productName;
             TbDescription.Text = Data.Description;
-            TbPGroup.Text = Data.PGroup;
+            CbGroup.Text = Data.PGroup;
             return this.ShowDialog();
         }
 
         private string GetTargetValue()
         {
-            if (CbType.Text == "Int" || Data.Type == "Double")
+            var type = CbType.Text;
+            if (type == "Int" || type == "Double")
             {
                 return NiNumberValue.Text;
             }
-            else if (CbType.Text == "Bool")
+            else if (type == "Bool")
             {
                 return CbBoolValue.Text;
             }

--
Gitblit v1.9.1