From 559890c482f5973f06aafdfec9550fee5ba3c7f2 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 17:02:15 +0800
Subject: [PATCH] feat: CAN 模拟器 TCP 化 + 多设备并发调试 + 后台生命周期管理
---
HMI.UI/DpUtil/FormGroupHelper.cs | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/HMI.UI/DpUtil/FormGroupHelper.cs b/HMI.UI/DpUtil/FormGroupHelper.cs
index bdfd5bd..bc45159 100644
--- a/HMI.UI/DpUtil/FormGroupHelper.cs
+++ b/HMI.UI/DpUtil/FormGroupHelper.cs
@@ -1,5 +1,6 @@
锘縰sing HMI.Core.Util;
using Panuon.WPF.UI;
+using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
@@ -49,7 +50,7 @@
DependencyProperty.RegisterAttached("ValidateMethod", typeof(ValidateMethodDelegate), typeof(FormGroupHelper),
new PropertyMetadata(null));
- public static bool ValidateForm(StackPanel fgPanel)
+ public static bool ValidateForm(StackPanel fgPanel, Dictionary<string, object> values = null)
{
if (fgPanel.Children == null) return true;
bool res = true;
@@ -57,6 +58,7 @@
{
if (child is FormGroup fg)
{
+ string fgName = fg.Name;
if (fg.Visibility != Visibility.Visible)
{
ClearValue(fg);
@@ -64,8 +66,17 @@
}
fg.ValidateResult = ValidateResult.None;
fg.Message = null;
- object content = fg.Content;
- object value = GetValidateValue(content);
+ object value;
+ if (values != null && values.ContainsKey(fgName))
+ {
+ value = values[fgName];
+ }
+ else
+ {
+ object content = fg.Content;
+ value = GetValidateValue(content);
+ }
+
if (GetIsRequired(fg) && (value == null || string.IsNullOrEmpty(value.ToString())))
{
fg.ValidateResult = ValidateResult.Error;
--
Gitblit v1.9.1