public void ClearErrors(IErrorSource source) { bool changed = false; _errorListView.BeginUpdate(); try { for (int i = _errorListView.Items.Count - 1; i >= 0; i--) { if (Object.ReferenceEquals(((ErrorItem)_errorListView.Items[i].Tag).Source, source)) { _errorListView.Items.RemoveAt(i); changed = true; } } } finally { _errorListView.EndUpdate(); } if (changed) { source.Disposed -= new EventHandler(ErrorSourceDisposed); _errorSources.Remove(source); } }
public Error(IErrorSource source, string message, ErrorLevel errorLevel) { if (source == null) throw new ArgumentNullException(nameof(source)); _source = source; _message = message; _errorLevel = errorLevel; }
public Error(IErrorSource source, string message, ErrorLevel errorLevel) { if (source == null) { throw new ArgumentNullException(nameof(source)); } _source = source; _message = message; _errorLevel = errorLevel; }
public void AppendErrors(IErrorSource source, ErrorList list, bool warning) { if ((list != null) && (list.Count > 0)) { _errorListView.BeginUpdate(); try { for (int i = list.Count - 1; i >= 0; i--) { InternalAppendError(source, list[i], warning); } } finally { _errorListView.EndUpdate(); } ErrorsAdded(warning); } }
private void InternalAppendError(IErrorSource source, Exception exception, bool warning) { if (exception != null) { ListViewItem item = new ListViewItem(); item.Tag = new ErrorItem(exception, source); item.ImageIndex = (warning ? 0 : 1); // if this is a DataphorException add the exception code to the description DataphorException localException = exception as DataphorException; item.SubItems.Add(String.Format("{0}{1}", localException != null ? String.Format("({0}:{1}) ", localException.Severity.ToString(), localException.Code.ToString()) : "", ExceptionUtility.BriefDescription(exception))); item.SubItems.Add(exception.GetType().ToString()); _errorListView.Items.Insert(0, item); if ((source != null) && (_errorSources[source] == null)) { _errorSources.Add(source, source); source.Disposed += new EventHandler(ErrorSourceDisposed); } } }
public ErrorItem(Exception AException, IErrorSource ASource) { Exception = AException; Source = ASource; }
public void AppendError(IErrorSource source, Exception exception, bool warning) { InternalAppendError(source, exception, warning); ErrorsAdded(warning); }
public void AppendErrors(IErrorSource source, ErrorList list) { AppendErrors(source, list, true); }