private void button_Start_Click(object sender, EventArgs e) { if (test.IsViewMode) { btn_start.Enabled = false; return; } SetDefaultZedTitle(); if (btn_start.Text == "开始测量") { test.ClearData(); test.SetStartInfo(); btn_start.Enabled = false; process.bRunning = true; cb_probetype.Enabled = false; btn_start.Text = "停止测量"; ClearGraph(""); uilock.Set(); backgroundWorker1.RunWorkerAsync(); btn_start.Enabled = true; } else { btn_start.Enabled = false; if (DialogResult.Yes != MessageBox.Show("是否要停止当前测量", "问题", MessageBoxButtons.YesNo)) { btn_start.Enabled = true; return; } backgroundWorker1.CancelAsync(); uilock.Set(); } }
private void button_Start_Click(object sender, EventArgs e) { if (test.IsViewMode) { btn_start.Enabled = false; return; } SetDefaultZedTitle(); if (btn_start.Text == "开始测量") { string sel = cb_probetype.SelectedItem.ToString(); if (!sel.StartsWith("Pt")) { MessageBox.Show("请选择被检温度计类型"); return; } test.ClearData(); test.SetStartInfo(); test.ProbeType = sel.Split(new char[] { '_' })[0].ToUpper(); string swire = sel.Split(new char[] { '_' })[1]; if (swire == "三线") { TestProcess.wire = WIREMODE.MODE_3WIRE; } else { TestProcess.wire = WIREMODE.MODE_4WIRE; } btn_start.Enabled = false; process.bRunning = true; cb_probetype.Enabled = false; btn_start.Text = "停止测量"; ClearGraph(""); uilock.Set(); backgroundWorker1.RunWorkerAsync(); btn_start.Enabled = true; } else { btn_start.Enabled = false; if (DialogResult.Yes != MessageBox.Show("是否要停止当前测量", "问题", MessageBoxButtons.YesNo)) { return; } backgroundWorker1.CancelAsync(); uilock.Set(); } }