private void checkBox1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { Clear(); sgSet = new SGSet(SL, pr); if (checkBox2.Checked) { jDemagnetizer.Start(0); } if (checkBox3.Checked) { string ret = sgSet.StartGSPF(); if (ret != null) { prstat(ret); Reset(); checkBox1.Checked = false; checkBox1.Text = checkBox1.Checked ? "Выключить" : "Включить"; return; } } label2.Text = sgSet.CheckDTypeSize()?null:"Датчики не соответствуют типоразмеру"; SolidGroupPars sgpars = ParAll.SG; L502Ch[] MCh = new L502Ch[6] { sgpars.Sensor_I, sgpars.Sensor_B, sgpars.Sensor_U, sgpars.Sensor_D0, sgpars.Sensor_D1, sgpars.Sensor_D2 }; sgSet.StartL502(MCh); checkBox2.Enabled = false; checkBox3.Enabled = false; timer1.Enabled = true; } else { pr("3 " + (checkBox1.Checked ? "true" : "false")); timer1.Enabled = false; Reset(); } checkBox1.Text = checkBox1.Checked ? "Выключить" : "Включить"; }
public void Exec(int _tick) { if (!started) { return; } if (IsComplete) { return; } if (IsError) { return; } foreach (IJob job in J) { job.Exec(_tick); if (job.IsError) { LastError = job.LastError; Finish(); return; } } switch (Step) { case 0: if (!sgSet.CheckDTypeSize()) { LastError = "Датчики не соответствуют типоразмеру"; break; } Step = 1; break; case 1: jAlarm.Add(SL.iCC, true); jAlarm.Add(SL.iSGIN, true); jAlarm.Add(SL.iSGOUT, true); Step = 2; break; case 2: SolidGroupPars sgpars = ParAll.SG; L502Ch[] MCh = new L502Ch[2] { sgpars.Sensor_I, sgpars.Sensor_B, }; jDemagnetizer.Start(_tick); string ret = sgSet.Start(tsDefSG, MCh); if (ret != null) { LastError = ret; break; } bank.Start(EUnit.SG, _tick); Step = 3; break; case 3: bank.AddGroup(EUnit.Cross, sgSet.ReadL502()); break; } if (IsError) { Finish(); } }