From c747e83c904c54a9506ac22a50515cef806e2789 Mon Sep 17 00:00:00 2001 From: wangsr Date: Wed, 13 Dec 2023 10:00:12 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E9=87=8D=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManualControl/ForceWaterControl.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ForceWaterControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ForceWaterControl.cs index a52627a..1f0464e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ForceWaterControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ForceWaterControl.cs @@ -42,13 +42,13 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl SetAllControls(); + StateRefresh(); + HslSwitchE.ForceControlHA.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlCA.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlHB.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlCB.OnSwitchChanged += ForceControl_OnSwitchChanged; - StateRefresh(new object(), new EventArgs()); - BottomSelect(runtime); //timer = new Timer(); @@ -60,6 +60,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void ForceControl_OnSwitchChanged(object obj, bool state) { DB2105 = new DB2105Helper(); + HslSwitch hslSwitch = obj as HslSwitch; if (state) { if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认", @@ -70,7 +71,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl return; } } - HslSwitch hslSwitch = obj as HslSwitch; string name = hslSwitch.Name; switch (name) { @@ -91,12 +91,24 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl DefaultSwitch(hslSwitch, state); } - private void StateRefresh(object sender, EventArgs e) + private void StateRefresh() { - HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn; - HslSwitchE.ForceControlCA.SwitchStatus = DB2105.Force_CA.forceOn; - HslSwitchE.ForceControlHB.SwitchStatus = DB2105.Force_HB.forceOn; - HslSwitchE.ForceControlCB.SwitchStatus = DB2105.Force_CB.forceOn; + if (HslSwitchE.ForceControlHA.SwitchStatus != DB2105.Force_HA.forceOn) + { + HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn; + } + if (HslSwitchE.ForceControlCA.SwitchStatus != DB2105.Force_CA.forceOn) + { + HslSwitchE.ForceControlCA.SwitchStatus = DB2105.Force_CA.forceOn; + } + if (HslSwitchE.ForceControlHB.SwitchStatus != DB2105.Force_HB.forceOn) + { + HslSwitchE.ForceControlHB.SwitchStatus = DB2105.Force_HB.forceOn; + } + if (HslSwitchE.ForceControlCB.SwitchStatus != DB2105.Force_CB.forceOn) + { + HslSwitchE.ForceControlCB.SwitchStatus = DB2105.Force_CB.forceOn; + } DefaultSwitch(HslSwitchE.ForceControlHA, DB2105.Force_HA.forceOn); DefaultSwitch(HslSwitchE.ForceControlCA, DB2105.Force_CA.forceOn); DefaultSwitch(HslSwitchE.ForceControlHB, DB2105.Force_HB.forceOn);