private void MouseDoubleClick(object para) { T1_SystemEvent ex = para as T1_SystemEvent; if (ex != null && ex.Type == (int)CustomSystemType.Alarm) { var itemTree = _organizationService.ItemTreeItems.Where(p => p.T_Item.Guid == ex.T_Item_Guid).FirstOrDefault(); //var itemTree = _organizationService.ItemTreeItems.Where(p => p.T_Item.Guid == new Guid("a0659d1e-2b1e-41ba-abe1-3d42caf678d9")).FirstOrDefault(); if (itemTree != null) { int height; switch ((ChannelType)ex.T_Item_Type) { case ChannelType.WirelessScalarChannelInfo: height = 260; break; case ChannelType.WirelessVibrationChannelInfo: height = 660; break; default: height = 260; break; } HistoryEventAlarmTrendView win = new HistoryEventAlarmTrendView(itemTree.Name, height); //win.ViewModel.AddData(itemTree, DateTime.Parse("10/20/2017 12:15:12"), DateTime.Parse("10/20/2017 13:15:12")); win.AddData(itemTree, ex.EventTime.AddHours(-1), ex.EventTime.AddHours(1)); win.Show(); } } }
public async Task AddSystemEvent(string ip, T1_SystemEvent exception) { if (LocalSetting.IsHistoryMode == true)//历史模式不存事件 { return; } string hostName = System.Net.Dns.GetHostName(); //本机名 System.Net.IPAddress[] addressList = System.Net.Dns.GetHostAddresses(hostName); //会返回所有地址,包括IPv4和IPv6 if (addressList.Select(p => p.ToString()).Contains(ip) || ip == "127.0.0.1" || LocalSetting.IsEventServer == true) //运行在服务器上,或者事件服务器 { await _databaseComponent.Add <T_SystemEvent>(ip, exception); } }
private void PublishMessage(CustomSystemType type, CustomSystemDegree grade, string alarmstring, Guid guid, short itemtype, string serverIP) { if (alarmstring == null || itemtype == (int)ChannelType.None || ACQDatetime == null) { _eventAggregator.GetEvent <CustomSystemEvent>().Publish(null); return; } T1_SystemEvent systemEvent = new T1_SystemEvent() { Type = (int)type, Degree = (int)grade, EventTime = ACQDatetime.Value, Remarks = alarmstring, T_Item_Guid = guid, T_Item_Type = itemtype, }; Tuple <string, T1_SystemEvent> ex = new Tuple <string, T1_SystemEvent>(serverIP, systemEvent); _eventAggregator.GetEvent <CustomSystemEvent>().Publish(ex); }