From b544d5cccd76735e034c8055918a50927b437474 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期二, 10 十一月 2026 08:29:04 +0800
Subject: [PATCH] fix: 维护模式重复进入失败与按钮灰死 + Broker 并发验证用例

---
 Plugin.DODriverControl/SingleControl.xaml.cs |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/Plugin.DODriverControl/SingleControl.xaml.cs b/Plugin.DODriverControl/SingleControl.xaml.cs
index 0767cb0..d63d0ce 100644
--- a/Plugin.DODriverControl/SingleControl.xaml.cs
+++ b/Plugin.DODriverControl/SingleControl.xaml.cs
@@ -311,11 +311,21 @@
         {
             if (data.Dio == DIOType.DI)
             {
-                return new LightBall
+                if (data.ControlType == ControlType.BOOL)
                 {
-                    Size = 40,
-                    DataContext = data
-                };
+                    return new LightBall
+                    {
+                        Size = 40,
+                        DataContext = data
+                    };
+                }
+                else
+                {
+                    return new TextBox
+                    {
+                        IsReadOnly = true
+                    };
+                }
             }
             Style btnStyle = this.FindResource("PrimaryButton") as Style;
             var btn = new Button
@@ -495,6 +505,7 @@
                         switch (data.ControlType)
                         {
                             case ControlType.BOOL:
+                            case ControlType.PULSE:
                                 if (data.Dio == DIOType.DI)
                                 {
                                     ((LightBall)ui).Value = value == data.PressDownValue;
@@ -513,9 +524,10 @@
                             case ControlType.LREAL:
                             case ControlType.STRING:
                             case ControlType.WSTRING:
-                                ((Button)ui).Content = value;
+                                ((TextBox)ui).Text = value;
                                 break;
                             default:
+                                ((TextBox)ui).Text = value;
                                 break;
                         }
                     });
@@ -539,6 +551,7 @@
                 value = null;
                 return false;
             }
+            string msg;
             switch (data.ControlType)
             {
                 case ControlType.BOOL:
@@ -546,11 +559,11 @@
                     bool res = false;
                     if (data.Dio == DIOType.DI)
                     {
-                        res = controller.ReadDIBool(data.Address, out val, out string msg);
+                        res = controller.ReadDIBool(data.Address, out val, out msg);
                     }
                     else
                     {
-                        res = controller.ReadDOBool(data.Address, out val, out string msg);
+                        res = controller.ReadDOBool(data.Address, out val, out msg);
                     }
                     if (res == true)
                     {
@@ -560,6 +573,10 @@
                     value = null;
                     return false;
                 default:
+                    if (controller.ReadDIDouble(data.Address, out double? dVal, out msg))
+                    {
+                        value = dVal.ToString();
+                    }
                     value = null;
                     return true;
             }

--
Gitblit v1.9.1