private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
int result = 0;
for (int i = 0; i < 100000; i++)
{
result += i;
}
System.Threading.Thread.Sleep(3000);
e.Result = result;
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
label1.Text =e.Result.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = "正在登陆中.....";
button1.Enabled = false;
backgroundWorker1.RunWorkerAsync();
}