public override void SingleRun() { for (int i = 0; i < mTestPoints.Length; i++) { SingleCurrentTest aPointTest = new SingleCurrentTest(mPort, mTestPoints[i], mTimes / mTestPoints.Length, mInterval); aPointTest.updateUi = updateUi; aPointTest.SetDatFile(mDatFile); aPointTest.Run(); } }
private void BTN_StabilityStart_Click(object sender, EventArgs e) { if (!CB_ElecModuleEnable.Checked) { MessageBox.Show("ElectricModule should be checked"); return; } StabilityTestRunning = true; BTN_StabilityStart.Enabled = false; int option = CMB_TestType.SelectedIndex; int duration = Int32.Parse(TB_Duration.Text); bool forceClose = CB_ForceClose.Checked; bool forceDisconnect = CB_ForceDisconnect.Checked; int maxRange = Int32.Parse(TB_MaxCurrent.Text); JzhTest aTest = null; switch (option) { case 0: { aTest = new SingleCurrentTest(port, maxRange, duration, 1000, CB_LogFileEnable.Checked); aTest.updateUi = UpdateUi; aTest.taskDone = TaskDone; break; } case 1: { double[] tests = new double[] { maxRange / 4, maxRange / 2, maxRange * 3 / 4, maxRange }; aTest = new MultiCurrentTest(port, tests, duration, 1000, CB_LogFileEnable.Checked); aTest.updateUi = UpdateUi; aTest.taskDone = TaskDone; break; } case 2: { aTest = new SetCurrentPartTest(port, maxRange, duration, 1000, CB_LogFileEnable.Checked); aTest.updateUi = UpdateUi; aTest.taskDone = TaskDone; break; } } Thread t = new Thread(new ThreadStart(aTest.Run)); t.Start(); }