/// <summary> /// /// </summary> /// <param name="e"></param> public DoWorkInput(DoWorkEventArgs e) { args = e; output = new DoWorkOutput { CloseOnError = false }; args.Result = output; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { Action next = null; DoWorkOutput output = null; if (!e.Cancelled) { output = e.Result as DoWorkOutput; } if (e.Error != null) { if (e.Cancelled) { // TODO } else { mView.ShowError(e.Error.Message); if (output.CloseOnError) { mView.Close(); } } } else if (e.Cancelled) { // TODO } else if (mRunWorkerCompleted != null) { mRunWorkerCompleted(output); next = output.NextOperation; } mRunWorkerCompleted = null; mView.SetIsWorking(false); if (next != null) { next(); } } catch (Exception ex) { Exception error = ex.InnerException ?? ex; mView.ShowError(error.Message); mView.SetIsWorking(false); } }