alielie
2026-04-23 ef52fd6fd07508883dce4eb002acda59f0169e59
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;
            }