將屬性分配給 BackgroundWorker

這允許在任務之間取消 BackgroundWorker

bgWorker.WorkerSupportsCancellation = true;

這允許工人報告任務完成之間的進度……

bgWorker.WorkerReportsProgress = true;

//this must also be used in conjunction with the ProgressChanged event