123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using NEIntelligentControl2.Models.Alarm;
- using NEIntelligentControl2.Models.Messages;
- using NEIntelligentControl2.Service.WebSocket;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace NEIntelligentControl2.Service.Alarm
- {
- /// <summary>
- /// 报警管理
- /// </summary>
- public class AlarmManager
- {
- public Action<List<FaultInfoModel>> OnFaultCount { get; set; }
- public Action<List<AlarmInfo>> OnAlarmCount { get; set; }
- private MessageBridge _MessageBridge;
- private FaultCountBridge _FaultCountBridge;
- private AlarmCountBridge _AlarmCountBridge;
- public AlarmManager(MessageBridge mb)
- {
- _MessageBridge = mb;
- _FaultCountBridge = new FaultCountBridge() { Messaged = OnFaultCountMessaged };
- _AlarmCountBridge = new AlarmCountBridge() { Messaged = OnAlarmCountMessaged };
- _MessageBridge.Register(_FaultCountBridge);
- _MessageBridge.Register(_AlarmCountBridge);
- }
- private void OnAlarmCountMessaged(List<AlarmInfo> obj)
- {
- try
- {
- OnAlarmCount?.Invoke(obj);
- }
- catch { }
- }
- private void OnFaultCountMessaged(List<FaultInfoModel> fims)
- {
- try
- {
- OnFaultCount?.Invoke(fims);
- }
- catch { }
- }
- }
- }
|