private void Run() { if (UninstallerBackgroundWorker.IsBusy != true) { // Start the asynchronous operation. UninstallerBackgroundWorker.RunWorkerAsync(); } }
private void btnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want cancel the uninstallation?", "Cancel uninstall of w3bot?", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { if (UninstallerBackgroundWorker.WorkerSupportsCancellation == true) { // Cancel the asynchronous operation. UninstallerBackgroundWorker.CancelAsync(); } } }