public void AddError(int code, string reason, string resolution, ErrorSerious serious) { if (code.ToString().Length <= 3) { Errors.Add(new ErrorBase(ErrorPrefix + code.ToString().PadLeft(3, '0'), reason, resolution, serious)); } else { ErrorLogManager.SystemErrors.RaiseError(102); } ErrorLogManager.AddErrorBase(new ErrorBase(ErrorPrefix + code.ToString().PadLeft(3, '0'), reason, resolution, serious)); }
public void RaiseError(int code, string remark = "", bool IsShowMessage = false) { ErrorBase err = Errors.Find(x => { return(Convert.ToInt32(x.ErrorCode.Substring(3, 3)) == code); }); if (err == null) { ErrorLogManager.SystemErrors.RaiseError(103, "使用了错误代号:" + code.ToString() + "!", true); return; } ErrorLogManager.AddErrorLog(err, remark); }
public ErrorForm() { InitializeComponent(); this.BackColor = SystemColors.ControlDarkDark; this.ForeColor = SystemColors.ControlLightLight; StateSelect = new Dictionary <string, bool>(); InitSelectWindow(); InitErrorGrid(); ErrorLogManager.ErrorRasied += ErrorLogManager_ErrorRasied; var historyerror = ErrorLogManager.GetHistoryError(); foreach (var x in historyerror) { AddError(x.Item2, x.Item1); } }