Esempio n. 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            client = AppContext.Instance.Client.InnerClient;
            var treeRoot1 = client.GetPhysicalTopologyTree(0);
            var treeRoot2 = client.GetDepartmentTree();

            ResourceTreeView1.LoadData(treeRoot1, treeRoot2);
            ResourceTreeView1.TopoTree.Tree.SelectedItemChanged += Tree_SelectedItemChanged;

            var devList = client.GetDevInfos(null);

            DeviceListBox1.LoadData(devList);

            var personList = client.GetPersonList();

            PersonListBox1.LoadData(personList);

            var tagList = client.GetTags();

            TagListBox1.LoadData(tagList);

            var archorList = client.GetArchors();

            AchorListBox1.LoadData(archorList);

            AppContext.Instance.CallbackClient.LocAlarmsReceved += CallbackClient_LocAlarmsReceved;

            DeviceAlarm[] devAlarms = client.GetDeviceAlarms(new AlarmSearchArg());
            ShowDeviceAlarms(devAlarms);

            LocationAlarm[] locAlarms = client.GetLocationAlarms(new AlarmSearchArg());
            ShowLocationAlarms(locAlarms);

            InitAlarmHub();
        }
Esempio n. 2
0
        private void Tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            currentArea = ResourceTreeView1.TopoTree.SelectedObject as AreaEntity;
            if (currentArea != null)
            {
                Bll bll         = new Bll();
                var switchAreas = bll.bus_anchor_switch_area.ToList();

                AreaCanvas1.ShowDev = true;
                AreaCanvas1.ShowArea(currentArea, switchAreas);

                AreaListBox1.LoadData(currentArea.Children);
                DeviceListBox1.LoadData(currentArea.LeafNodes);

                ShowPersons();

                ArchorListExportControl1.Clear();
                TabControl1.SelectionChanged -= TabControl1_OnSelectionChanged;
                TabControl1.SelectionChanged += TabControl1_OnSelectionChanged;

                if (TabControl1.SelectedIndex == 2)
                {
                    ArchorListExportControl1.LoadData(currentArea.Id);
                    TabControl1.SelectionChanged -= TabControl1_OnSelectionChanged;
                }
            }
            else
            {
                var dev = ResourceTreeView1.TopoTree.SelectedObject as DevEntity;
                if (dev != null)
                {
                    AreaCanvas1.SelectDevById(dev.Id);
                }
            }
        }
Esempio n. 3
0
        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);
            });
        }
Esempio n. 4
0
        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);
            });
        }