public Form GetForm(ErrorContext context) { if (null == context) { throw new ArgumentNullException(nameof(context)); } var errorFormTemplate = new ErrorFormTemplate(context.Caption, context.Message); errorFormTemplate.SetTemplateInternals(nameof(ErrorForm), null); if (null != context.Details) { errorFormTemplate.Details = context.Details; } switch (context.Level) { case ErrorContext.ErrorLevel.Error: errorFormTemplate.Level = ErrorLevel.Error; break; case ErrorContext.ErrorLevel.Warning: errorFormTemplate.Level = ErrorLevel.Warning; break; default: throw new ArgumentOutOfRangeException(nameof(context)); } return(new ErrorForm(errorFormTemplate)); }
private void mBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (IsDisposed) { return; } mFlowLayoutPanel.Enabled = true; previousButton.Enabled = true; nextButton.Enabled = true; mToolStripProgressBar.Visible = false; var error = e.Error; if (null != error) { if (null != ErrorAction) { ErrorAction(error); } else { var errorFormTemplate = new ErrorFormTemplate { Caption = error.GetType().Name, Message = error.Message, Details = error.ToString() }; errorFormTemplate.SetTemplateInternals(_templateName, _templateBaseDirectory); ErrorForm.ShowDialog(this, errorFormTemplate); } return; } var values = e.Result as Dictionary <string, object>; if (_currentShapeIndex + 1 < _steps.Count) { _currentShapeIndex++; ApplyShape(values); previousButton.Visible = true; return; } if (null != FinalAction) { if (!FinalAction(values)) { return; } } DialogResult = DialogResult.OK; Close(); }
private void mBackgroundWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { if (IsDisposed) { return; } var error = e.Error; if (null != error) { mProgressBar.Style = ProgressBarStyle.Blocks; mProgressBar.Value = 100; if (!ApplicationUtility.IsRunningOnMono) { SetState(mProgressBar, 2); } string connectionString = string.Empty; var connectionSettings = _session.AuthenticationService.GetConnectionSettings(); if (null != connectionSettings) { connectionString = connectionSettings.ConnectionString; } string caption = Resources.ProgressForm_mBackgroundWorker_RunWorkerCompleted_Connection_error; string message = string.Format(Resources.ProgressForm_mBackgroundWorker_RunWorkerCompleted_Could_not_connect_to_the_database_with_connection_string___0___, connectionString); var errorFormTemplate = new ErrorFormTemplate(caption, message) { Details = error.ToString() }; errorFormTemplate.SetTemplateInternals(ExtensionCatalog.Enter, null); ErrorForm.ShowDialog(this, errorFormTemplate); DialogResult = DialogResult.Cancel; } else { DialogResult = DialogResult.OK; } }