// This returns the list of errors /*internal List<ErrorItem> GetErrors() * { * lock(this) * { * List<ErrorItem> copylist = new List<ErrorItem>(errors); * return copylist; * } * }*/ //mxd. This returns the list of errors starting at given index internal IEnumerable <ErrorItem> GetErrors(int startindex) { if (startindex >= errors.Count) { return(new List <ErrorItem>()); } ErrorItem[] result = new ErrorItem[errors.Count - startindex]; errors.CopyTo(startindex, result, 0, result.Length); return(result); }
public void Add(ErrorItem error) //mxd { lock (threadlock) { //mxd. Don't add duplicate messages if (errors.Count == 0 || error.Description != errors[errors.Count - 1].Description || error.Type != errors[errors.Count - 1].Type) { errors.Add(error); string prefix = ""; switch (error.Type) { case ErrorType.Error: erroradded = true; prefix = "ERROR: "; #if DEBUG DebugConsole.WriteLine(DebugMessageType.ERROR, error.Description); #endif break; case ErrorType.Warning: warningadded = true; prefix = "WARNING: "; #if DEBUG DebugConsole.WriteLine(DebugMessageType.WARNING, error.Description); #endif break; } changed = true; General.WriteLogLine(prefix + error.Description); General.MainWindow.SetWarningsCount(errors.Count, erroradded); //mxd } // But still blink the indicator on errors else if (error.Type == ErrorType.Error) { General.MainWindow.SetWarningsCount(errors.Count, true); } } }