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 { /// /// 报警管理 /// public class AlarmManager { public Action> OnFaultCount { get; set; } public Action> 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 obj) { try { OnAlarmCount?.Invoke(obj); } catch { } } private void OnFaultCountMessaged(List fims) { try { OnFaultCount?.Invoke(fims); } catch { } } } }