private void BntRunAuto_Click(object sender, EventArgs e) { // runOrStop, true for run, false for stop if (runOrStop) { // Change the button to Stop function this.BntRunAuto.Text = "终止"; // Disable manual menu to avoid this.MenuManual.Enabled = false; this.MenuParaSet.Enabled = false; this.MenuComSet.Enabled = false; // Init auto control float initTemp = float.Parse(TxtInitTemp.Text); float intervalTemp = float.Parse(TxtIntervalTemp.Text); autoStep = new StepControl(initTemp, intervalTemp, intervalTemp > 0); // Record the start time GlbVars.ctrlStartTime = DateTime.Now; // Run blinkTimer.Enabled = true; autoStep.ThisTurn(); GlbVars.tempReadTimer.Enabled = true; } else { // Change the button to Stop function this.BntRunAuto.Text = "运行"; // Enable all menus this.MenuManual.Enabled = true; this.MenuParaSet.Enabled = true; this.MenuComSet.Enabled = true; // Stop timer GlbVars.tempReadTimer.Enabled = false; blinkTimer.Enabled = false; // Fix flucShow to read and show PicFlucShow.BackColor = Color.Red; PicFlucShow.Visible = true; // Finish the temperature data file Data2File.FinishTempFile(); } runOrStop = !runOrStop; }
private void BntRun_Click(object sender, EventArgs e) { // runOrStop, true for run, false for stop if (runOrStop) { // Change the button to Stop function this.BntRun.Text = "终止"; // Init auto control float initTemp = float.Parse(TxtInitTemp.Text); float intervalTemp = float.Parse(TxtIntervalTemp.Text); autoStep = new StepControl(initTemp, intervalTemp, intervalTemp > 0); // Record the start time GlbVars.ctrlStartTime = DateTime.Now; // Run blinkTimer.Enabled = true; autoStep.ThisTurn(); GlbVars.tempReadTimer.Enabled = true; } else { // Change the button to Stop function this.BntRun.Text = "运行"; // Stop timer GlbVars.tempReadTimer.Enabled = false; blinkTimer.Enabled = false; // Fix Blink to visible BlinkBlink.Visible = true; // Finish the temperature data file Data2File.FinishTempFile(); } runOrStop = !runOrStop; }