From d437e53b2eea04f88217d719abc8d34ba5b25c2c Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期五, 10 七月 2020 17:36:41 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs index 13762cf..3ac3207 100644 --- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs +++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs @@ -10,6 +10,8 @@ using Bro.Common.Model; using Bro.UI.Model.Winform; using static Bro.Common.Helper.EnumHelper; +using Bro.Common.Interface; +using Bro.Common.Base; namespace Bro.UI.Device.Winform { @@ -20,13 +22,38 @@ public CtrlMotionCardIOStatus() { InitializeComponent(); + InitIOEvent(); + } + private IDevice Device { get; set; } + + protected MotionCardBase MotionCard + { + get => Device as MotionCardBase; } - - public CtrlMotionCardIOStatus(List<IOItem> monitorValues) + public CtrlMotionCardIOStatus(IDevice device, List<IOItem> monitorValues) { InitializeComponent(); + Device = device; _monitorValues = monitorValues; + InitIOEvent(); + } + + private void InitIOEvent() + { + foreach (var ctr in groupBoxIOOut.Controls) + { + if (ctr is IOIndicatorCtrl ioOut) + { + ioOut.OnIODoubleClick += IoOut_DoubleClick; + } + } + } + + private void IoOut_DoubleClick(string desc, bool isOn) + { + var index = Convert.ToInt16(desc.Substring(3)); + MotionCard.WriteOutput(index, isOn ? IOValue.FALSE : IOValue.TRUE); } private void RefreshIOStatus(object sender, EventArgs e) -- Gitblit v1.8.0