[csharp]
Thread tr = null;
delegate void Methinvoker();
private void btSeInfo_Click(object sender, EventArgs e)
{
tr = new Thread(new ThreadStart(SeleInfo));
tr.IsBackground = true;
// tr.SetApartmentState(ApartmentState.STA);
tr.Start();
Thread tr1 = new Thread(new ThreadStart(StartThreadCaiji));
tr1.Start();
}
private void StartThreadCaiji()
{
tr.Join();
Methinvoker meth = new Methinvoker(MessSeInfo);
this.BeginInvoke(meth);
}
private void MessSeInfo()
{
//Monitor.Enter(obj);
// Monitor.Wait(obj);
MessageBox.Show("數據采集完成,成功采集記錄總數:【" + caiji.ToString() + "】條\n 其中紅色訊號燈表示通訊錯誤,綠色表示提取成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
pbLoad.Value = 0;
tbpg.Text = "";
caiji = 0;
btStopSelect.Enabled = false;
// Monitor.Exit(obj);
}
Thread tr = null;
delegate void Methinvoker();
private void btSeInfo_Click(object sender, EventArgs e)
{
tr = new Thread(new ThreadStart(SeleInfo));
tr.IsBackground = true;
// tr.SetApartmentState(ApartmentState.STA);
tr.Start();
Thread tr1 = new Thread(new ThreadStart(StartThreadCaiji));
tr1.Start();
}
private void StartThreadCaiji()
{
tr.Join();
Methinvoker meth = new Methinvoker(MessSeInfo);
this.BeginInvoke(meth);
}
private void MessSeInfo()
{
//Monitor.Enter(obj);
// Monitor.Wait(obj);
MessageBox.Show("數據采集完成,成功采集記錄總數:【" + caiji.ToString() + "】條\n 其中紅色訊號燈表示通訊錯誤,綠色表示提取成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
pbLoad.Value = 0;
tbpg.Text = "";
caiji = 0;
btStopSelect.Enabled = false;
// Monitor.Exit(obj);
}