protected virtual void m_progressDialog_Canceling(object sender, CancelEventArgs e) { bool cancel = true; if (Canceling != null) { var cea = new CancelEventArgs(); Canceling(this, cea); e.Cancel = cea.Cancel; cancel = !cea.Cancel; } if (cancel) m_worker.CancelAsync(); }