/// <summary> /// 关闭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Cancel_Click(object sender, EventArgs e) { if (backgroundWorker.IsBusy) { updateStatus("正在取消当前操作,请稍候..."); backgroundWorker.CancelAsync(); this.Cancel.Text = "关闭"; this.Cancel.Enabled = false; } else if (this.Cancel.Text == "关闭") { //this.Dispose(); this.Close(); } }
private void CloseButton_Click(object sender, EventArgs e) { try { CloseButton.Enabled = false; StatusLabel.Text = "Attempting to cancel, please wait..."; MyBackgroundWorker.CancelAsync(); MyCancelled = true; } catch (Exception ex) { HandleError("Error when cancelling operation.", ex); } }
private void CancelButton_Click(object sender, EventArgs e) { MyBackgroundWorker.CancelAsync(); CancelButton.Enabled = false; }
private void CancelButton_Click(object sender, EventArgs e) { //indicates to cancel the background worker. MyBackgroundWorker.CancelAsync(); CancelButton.Enabled = false; }