private void LoadDevList() { LocationService service = new LocationService(); var devlist = service.GetAllDevInfos(); DeviceListBox1.LoadData(devlist); DeviceListBox1.AddMenu("告警", (se, arg) => { //MessageBox.Show("告警" + DeviceListBox1.CurrentDev.Name); //todo:告警事件推送 var dev = DeviceListBox1.CurrentDev; DeviceAlarm alarm = new DeviceAlarm() { Id = dev.Id, Level = Abutment_DevAlarmLevel.低, Title = "告警" + dev.Id, Message = GetAlarmMsg(dev), CreateTime = new DateTime(2018, 8, 28, 9, 5, 34) }.SetDev(dev); AlarmHub.SendDeviceAlarms(alarm); }); DeviceListBox1.AddMenu("消警", (se, arg) => { //MessageBox.Show("消警" + DeviceListBox1.CurrentDev.Name); var dev = DeviceListBox1.CurrentDev; DeviceAlarm alarm = new DeviceAlarm() { Id = dev.Id, Level = Abutment_DevAlarmLevel.无, Title = "消警" + dev.Id, Message = "设备消警", CreateTime = new DateTime(2018, 8, 28, 9, 5, 34) }.SetDev(dev); AlarmHub.SendDeviceAlarms(alarm); }); }
private void LoadDevList() { LocationService service = new LocationService(); var devlist = service.GetAllDevInfos(); DeviceListBox1.LoadData(devlist.ToList()); DeviceListBox1.AddMenu("告警", (se, arg) => { //MessageBox.Show("告警" + DeviceListBox1.CurrentDev.Name); //todo:告警事件推送 //var dev = DeviceListBox1.CurrentDev; //DeviceAlarm alarm = CreateDevAlarm(dev); //AlarmHub.SendDeviceAlarms(alarm); var dev = DeviceListBox1.CurrentDev; DeviceAlarm alarm = CreateDevAlarm(dev); Bll bll = Bll.NewBllNoRelation(); var hisItem = RemoveToHistory(alarm); bll.DevAlarmHistorys.Add(hisItem); AlarmHub.SendDeviceAlarms(alarm); }); DeviceListBox1.AddMenu("消警", (se, arg) => { //MessageBox.Show("消警" + DeviceListBox1.CurrentDev.Name); var dev = DeviceListBox1.CurrentDev; DeviceAlarm alarm = new DeviceAlarm() { Id = dev.Id, Level = Abutment_DevAlarmLevel.无, Title = "消警" + dev.Id, Message = "设备消警", CreateTime = new DateTime(2018, 8, 28, 9, 5, 34) }.SetDev(dev); AlarmHub.SendDeviceAlarms(alarm); }); }