change - 重复提示问题解决

dep
wangsr 12 months ago
parent f94acb881a
commit c747e83c90

@ -42,13 +42,13 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
SetAllControls(); SetAllControls();
StateRefresh();
HslSwitchE.ForceControlHA.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlHA.OnSwitchChanged += ForceControl_OnSwitchChanged;
HslSwitchE.ForceControlCA.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlCA.OnSwitchChanged += ForceControl_OnSwitchChanged;
HslSwitchE.ForceControlHB.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlHB.OnSwitchChanged += ForceControl_OnSwitchChanged;
HslSwitchE.ForceControlCB.OnSwitchChanged += ForceControl_OnSwitchChanged; HslSwitchE.ForceControlCB.OnSwitchChanged += ForceControl_OnSwitchChanged;
StateRefresh(new object(), new EventArgs());
BottomSelect(runtime); BottomSelect(runtime);
//timer = new Timer(); //timer = new Timer();
@ -60,6 +60,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void ForceControl_OnSwitchChanged(object obj, bool state) private void ForceControl_OnSwitchChanged(object obj, bool state)
{ {
DB2105 = new DB2105Helper(); DB2105 = new DB2105Helper();
HslSwitch hslSwitch = obj as HslSwitch;
if (state) if (state)
{ {
if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认", if (MessageBox.Show("是否要打开强制排水模式?", "强制模式启动确认",
@ -70,7 +71,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
return; return;
} }
} }
HslSwitch hslSwitch = obj as HslSwitch;
string name = hslSwitch.Name; string name = hslSwitch.Name;
switch (name) switch (name)
{ {
@ -91,12 +91,24 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
DefaultSwitch(hslSwitch, state); DefaultSwitch(hslSwitch, state);
} }
private void StateRefresh(object sender, EventArgs e) private void StateRefresh()
{ {
HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn; if (HslSwitchE.ForceControlHA.SwitchStatus != DB2105.Force_HA.forceOn)
HslSwitchE.ForceControlCA.SwitchStatus = DB2105.Force_CA.forceOn; {
HslSwitchE.ForceControlHB.SwitchStatus = DB2105.Force_HB.forceOn; HslSwitchE.ForceControlHA.SwitchStatus = DB2105.Force_HA.forceOn;
HslSwitchE.ForceControlCB.SwitchStatus = DB2105.Force_CB.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.ForceControlHA, DB2105.Force_HA.forceOn);
DefaultSwitch(HslSwitchE.ForceControlCA, DB2105.Force_CA.forceOn); DefaultSwitch(HslSwitchE.ForceControlCA, DB2105.Force_CA.forceOn);
DefaultSwitch(HslSwitchE.ForceControlHB, DB2105.Force_HB.forceOn); DefaultSwitch(HslSwitchE.ForceControlHB, DB2105.Force_HB.forceOn);

Loading…
Cancel
Save