示例#1
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (BkGdWorker.WorkerSupportsCancellation == true)
     {
         // Cancel the asynchronous operation.
         BkGdWorker.CancelAsync();
     }
 }
示例#2
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     if (BkGdWorker.IsBusy != true)
     {
         // Start the asynchronous operation.
         progressBar1.Visible = true;
         resultLabel.Text     = "In progress...";
         progressBar1.Value   = 0;
         timer.Enabled        = true;
         timer.Tick          += new EventHandler(timer_Tick);
         // Sets the timer interval to X seconds (milisecs).
         timer.Interval = 2000;
         timer.Start();
         BkGdWorker.RunWorkerAsync();
     }
 }