/// <summary> /// 设置报警 /// </summary> /// <param name="lever"></param> /// <param name="msg"></param> public static void SetAlarm(AlarmLevelEnum lever, string msg) { ErrorMsg error = new ErrorMsg(lever, msg); if (ErrorMap.Contains(error) == false) { ErrorMap.Add(error); //ErrorMap.Sort(Comparer<ErrorMsg>.Default); ShowMessge.SendStartMsg(msg); //报警 EventHandler handler = AlarmError; if (handler != null) { handler(error, EventArgs.Empty); } } }
public static bool RefreshCurrAlamrMsgFlag;//更新当前报警信息 /// <summary> /// 设置报警 /// </summary> /// <param name="lever"></param> /// <param name="msg"></param> public static void SetAlarm(AlarmLevelEnum lever, string msg) { ErrorMsg error = new ErrorMsg(DateTime.Now.ToString(), lever, msg); if (ErrorMap.Contains(error) == false) { ErrorMap.Add(error); //ErrorMap.Sort(Comparer<ErrorMsg>.Default); ErrorMapIsChange = true; RefreshCurrAlamrMsgFlag = true; ShowMessge.SendStartMsg(msg); //报警 EventHandler handler = AlarmError; if (handler != null) { handler(error, EventArgs.Empty); } AlarmLog.AddLog(msg); } }