public async void Command_CleanNow_Click(object sender, RoutedEventArgs e) { Worker.I.bgWorker.RunWorkerCompleted -= bgWorkerCleaner_RunWorkerCompleted; Worker.I.bgWorker.RunWorkerCompleted += bgWorkerCleaner_RunWorkerCompleted; CleanerML.Cancel = false; Worker.I.Preview = false; CleanerML.btnCloseEnable = false; CleanerML.IsCancelProcessEnabled = true; CleanerML.Run = true; CleanerML.btnPreviewCleanEnable = false; CleanerML.btnCleaningOptionsEnable = false; CleanerML.ShowCleanerDescription = false; CleanerML.ShowFrontPage = false; CleanerML.txtLoForgoundColor = "Red"; await CleanerML.Start(); // some time, user may have cancel the operation if (CleanerML.Cancel) { ProgressWorker.I.EnQ("Operation Canceled"); } Worker.I.DoWork(); // CleanerML.btnCloseEnable = true; // CleanerML.ProgressIsIndeterminate = false; // CleanerML.IsCancelProcessEnabled = false; // CleanerML.btnCleaningOptionsEnable = true; //CleanerML.ProgressText = "Done"; }