[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 ("Total number of records successfully collected after data collection is completed: [" + caiji. toString () + "] \ n, where red signals indicate communication errors, and Green indicates extraction successful! "," Prompt ", 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 ("Total number of records successfully collected after data collection is completed: [" + caiji. toString () + "] \ n, where red signals indicate communication errors, and Green indicates extraction successful! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
PbLoad. Value = 0;
Tbpg. Text = "";
Caiji = 0;
BtStopSelect. Enabled = false;
// Monitor. Exit (obj );
}