Ejemplo n.º 1
0
        /// <summary>
        /// 初始化展示设备
        /// </summary>
        private void InitShowDevice()
        {
            List <ShowDevice> showDeviceList = ShowDevice.FindAll();

            //foreach (var showDevice in showDeviceList)
            //{
            //    this.cbShowDevice.Items.Add(showDevice);
            //    this.cbShowDevice.DisplayMember = showDevice.ID.ToString();
            //    this.cbShowDevice.ValueMember = showDevice.Name;
            //}
            if (showDeviceList.Count > 0)
            {
                this.cbShowDevice.DataSource    = showDeviceList;
                this.cbShowDevice.DisplayMember = "Name";
                this.cbShowDevice.ValueMember   = "ID";
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化展示设备列表
        /// </summary>
        private void InitShowDeviceListView()
        {
            this.listView1.Items.Clear();
            List <ShowDevice> showDeviceList = ShowDevice.FindAll();

            foreach (var showDevice in showDeviceList)
            {
                var strings = new string[]
                {
                    showDevice.ID.ToString(), showDevice.Name, showDevice.ShowDeviceTypeName,
                         showDevice.CommunicateDeviceName, showDevice.Address, showDevice.Remark
                };
                var listViewItem = new ListViewItem(strings);
                listViewItem.Tag = showDevice;
                this.listView1.Items.Add(listViewItem);
            }
        }
Ejemplo n.º 3
0
        private void InitData()
        {
            var facs = Facility.FindAllByFarmID(_farmId);

            if (facs != null && facs.Count > 0)
            {
                foreach (var fac in facs)
                {
                    var facnode = new DevComponents.AdvTree.Node("设施")
                    {
                        ImageIndex = 0,
                        Tag        = fac,
                        //TagString="Facility",
                        Expanded = true,
                        Name     = fac.Name,
                        Text     = fac.Name
                    };
                    this.advTreeData.Nodes.AddRange(new DevComponents.AdvTree.Node[] { facnode });

                    var collectnode = new DevComponents.AdvTree.Node("采集设备")
                    {
                        ImageIndex = 1, Tag = "SensorDeviceUnit"
                    };
                    var collects = fac.FacilitySensorDeviceUnits;
                    if (collects != null && collects.Count > 0)
                    {
                        foreach (var c in collects)
                        {
                            var cnode = new DevComponents.AdvTree.Node
                            {
                                Expanded = true,
                                Name     = c.SensorDeviceUnit.Name,
                                Text     = c.SensorDeviceUnit.Name,
                                Tag      = c.SensorDeviceUnit,
                                //TagString = "SensorDeviceUnit"
                            };
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.SensorDeviceUnit.ProcessedValue.ToString(), Name = c.SensorDeviceUnit.ProcessedValue.ToString()
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.SensorDeviceUnit.Sensor.Unit, Name = c.SensorDeviceUnit.Sensor.Unit
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.SensorDeviceUnit.UpdateTime.ToString(), Name = c.SensorDeviceUnit.UpdateTime.ToString()
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.Code1, Name = c.Code1
                            });
                            collectnode.Nodes.Add(cnode);
                        }
                    }
                    facnode.Nodes.Add(collectnode);

                    var controlnode = new DevComponents.AdvTree.Node("控制设备")
                    {
                        ImageIndex = 2, Tag = "ControlDeviceUnit"
                    };
                    var fcontrols = fac.FacilityControlDeviceUnits;
                    if (fcontrols != null && fcontrols.Count > 0)
                    {
                        foreach (var fc in fcontrols)
                        {
                            ControlDeviceUnit.FindByGroupNum(fc.ControlDeviceUnitGroupNum).ForEach(control =>
                            {
                                var cnode = new DevComponents.AdvTree.Node
                                {
                                    Expanded = true,
                                    Name     = control.Name,
                                    Text     = control.Name,
                                    Tag      = control,
                                    //TagString = "ControlDeviceUnit"
                                };
                                cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                    Text = control.ProcessedValue.ToString(), Name = control.ProcessedValue.ToString()
                                });
                                cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                    Text = " ", Name = " "
                                });
                                cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                    Text = control.UpdateTime.ToString(), Name = control.UpdateTime.ToString()
                                });
                                cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                    Text = fc.Code1, Name = fc.Code1
                                });
                                controlnode.Nodes.Add(cnode);
                            });
                        }
                    }
                    facnode.Nodes.Add(controlnode);

                    var cameranode = new DevComponents.AdvTree.Node("视频设备")
                    {
                        ImageIndex = 3, Tag = "Camera"
                    };
                    var cameras = fac.FacilityCameras;
                    if (cameras != null && cameras.Count > 0)
                    {
                        foreach (var c in cameras)
                        {
                            var cnode = new DevComponents.AdvTree.Node
                            {
                                Expanded = true,
                                Name     = c.Camera.Name,
                                Text     = c.Camera.Name,
                                Tag      = c.Camera,
                                //TagString = "Camera"
                            };
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = "正常", Name = "正常"
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = "", Name = ""
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.UpdateTime.ToString(), Name = c.UpdateTime.ToString()
                            });
                            cnode.Cells.Add(new DevComponents.AdvTree.Cell {
                                Text = c.Code1, Name = c.Code1
                            });
                            cameranode.Nodes.Add(cnode);
                        }
                    }
                    facnode.Nodes.Add(cameranode);

                    var shownode = new DevComponents.AdvTree.Node("展示设备")
                    {
                        ImageIndex = 4, Tag = "ShowDevice"
                    };
                    var shows = ShowDevice.FindAll();
                    if (shows != null && shows.Count > 0)
                    {
                        foreach (var s in shows)
                        {
                            var cnode = new DevComponents.AdvTree.Node
                            {
                                Expanded = true,
                                Name     = s.Name,
                                Text     = s.Name,
                                Tag      = s,
                                //TagString = "ShowDevice"
                            };
                            shownode.Nodes.Add(cnode);
                        }
                    }
                    facnode.Nodes.Add(shownode);
                }
            }
        }