/// <summary> /// 报警处理 /// </summary> /// <param name="mon"></param> protected void CheckAlarm(byte[] alarmCode) { try { List <string> acList = new List <string>(); //未有报警 if (alarmCode.Length == 0 || alarmCode[0] == 0x00) { //删除当前报警(当前报警自动转化为历史报警) AlarmHelper.RemoveAlarm(GlobalConfig.AlarmSource); } else { //添加MCU报警 for (int i = 0; alarmCode != null && i < alarmCode.Length; i++) { if (alarmCode[i] > 0x00) { acList.Add(string.Format("0x{0}", CII.Library.Util.Sundry.StringUtil.ByteToString(alarmCode[i]))); } } AlarmHelper.AddAlarm(GlobalConfig.AlarmSource, acList); } } catch (Exception ex) { Entry.LAR.Entry.LogException(ex); } }
public static async Task DeleteAlarm(MyAlarm alarm) { try { Alarms.Remove(alarm); await Task.Run(async delegate { await SaveAlarmsAsync(); AlarmHelper.RemoveAlarm(alarm); }); } catch { } }