Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public Error(IErrorSource source, string message, ErrorLevel errorLevel)
        {
            if (source == null) throw new ArgumentNullException(nameof(source));

            _source = source;
            _message = message;
            _errorLevel = errorLevel;
        }
Ejemplo n.º 3
0
        public Error(IErrorSource source, string message, ErrorLevel errorLevel)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            _source     = source;
            _message    = message;
            _errorLevel = errorLevel;
        }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
 public ErrorItem(Exception AException, IErrorSource ASource)
 {
     Exception = AException;
     Source    = ASource;
 }
Ejemplo n.º 7
0
 public void AppendError(IErrorSource source, Exception exception, bool warning)
 {
     InternalAppendError(source, exception, warning);
     ErrorsAdded(warning);
 }
Ejemplo n.º 8
0
 public void AppendErrors(IErrorSource source, ErrorList list)
 {
     AppendErrors(source, list, true);
 }