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.Device.GTSCard/Bro.Device.GTSCard.csproj | 8 +++- src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs | 18 +++++++++ src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs | 2 src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.Designer.cs | 2 + src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs | 31 ++++++++++++++- 5 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj b/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj index ce0cad6..70fa0fa 100644 --- a/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj +++ b/src/Bro.Device.GTSCard/Bro.Device.GTSCard.csproj @@ -67,10 +67,14 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <Content Include="gts.dll" /> + <Content Include="gts.dll"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> </ItemGroup> <ItemGroup> - <None Include="GTS800.cfg" /> + <None Include="GTS800.cfg"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> <None Include="packages.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 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) diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs index 23144a3..05b0341 100644 --- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs +++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs @@ -55,7 +55,7 @@ } - CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(MotionCard.MonitorValues); + CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(Device, MotionCard.MonitorValues); //ctrlMotionCardIOStatus.Dock = DockStyle.Fill; flowLayoutPanel2.Controls.Add(ctrlMotionCardIOStatus); } diff --git a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.Designer.cs b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.Designer.cs index 0540cb0..2f87a0e 100644 --- a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.Designer.cs +++ b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.Designer.cs @@ -41,6 +41,7 @@ this.plStatus.Size = new System.Drawing.Size(24, 24); this.plStatus.TabIndex = 0; this.plStatus.Paint += new System.Windows.Forms.PaintEventHandler(this.plStatus_Paint); + this.plStatus.DoubleClick += new System.EventHandler(this.plStatus_DoubleClick); // // lblDesc // @@ -55,6 +56,7 @@ this.lblDesc.TabIndex = 1; this.lblDesc.Text = "XXXX"; this.lblDesc.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblDesc.DoubleClick += new System.EventHandler(this.lblDesc_DoubleClick); // // IOIndicatorCtrl // diff --git a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs index d1b0a30..3713aed 100644 --- a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs +++ b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs @@ -101,5 +101,23 @@ g.FillPolygon(Brushes.White, regionBlink); } } + + public event Action<string,bool> OnIODoubleClick; + + private void lblDesc_DoubleClick(object sender, EventArgs e) + { + if (IsOn != null) + { + OnIODoubleClick?.Invoke(Desc,IsOn.Value); + } + } + + private void plStatus_DoubleClick(object sender, EventArgs e) + { + if (IsOn != null) + { + OnIODoubleClick?.Invoke(Desc, IsOn.Value); + } + } } } -- Gitblit v1.8.0