Example #1
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            var types = DeviceType.FindAll();
            var names = new ArrayList();

            if (types != null && types.Count > 0)
            {
                names.AddRange(types);
            }
            return(new StandardValuesCollection(names));
        }
Example #2
0
        /// <summary>
        /// 初始化设备类型
        /// </summary>
        private void InitDeviceType()
        {
            List <DeviceType> deviceTypeList = DeviceType.FindAll();

            //foreach (var deviceType in deviceTypeList)
            //{
            //    this.cbDeviceType.Items.Add(deviceType);
            //    this.cbDeviceType.DisplayMember = deviceType.Serialnum;
            //    this.cbDeviceType.ValueMember = deviceType.Name;
            //}
            if (deviceTypeList.Count > 0)
            {
                this.cbDeviceType.DataSource    = deviceTypeList;
                this.cbDeviceType.DisplayMember = "Name";
                this.cbDeviceType.ValueMember   = "Serialnum";
            }
        }
        /// <summary>
        /// 初始化设备类型列表
        /// </summary>
        private void InitDeviceTypeListView()
        {
            this.listView1.Items.Clear();
            List <DeviceType> deviceTypeList = DeviceType.FindAll();

            foreach (var deviceType in deviceTypeList)
            {
                var strings = new string[]
                {
                    deviceType.Serialnum, deviceType.Name, deviceType.ParentSerialnum, deviceType.Version.ToString(),
                    deviceType.CreateTime.ToString(), deviceType.UpdateTime.ToString(), deviceType.PhotoUrl,
                    deviceType.Introduce, deviceType.Upload.ToString(), deviceType.Remark
                };
                var listViewItem = new ListViewItem(strings);
                listViewItem.Tag = deviceType;
                this.listView1.Items.Add(listViewItem);
            }
        }
Example #4
0
 private void BaseConfig_Load(object sender, EventArgs e)
 {
     if (ClassName.EqualIgnoreCase("CommunicateDeviceType"))
     {
         this.Name = "CommunicateDeviceType";
         var types = CommunicateDeviceType.FindAll();
         this.dataGridViewX1.DataSource = types;
     }
     if (ClassName.EqualIgnoreCase("Sensor"))
     {
         this.Name = "Sensor";
         this.dataGridViewX1.DataSource = Sensor.FindAll();
     }
     if (ClassName.EqualIgnoreCase("RelayType"))
     {
         this.Name = "RelayType";
         this.dataGridViewX1.DataSource = RelayType.FindAll();
     }
     if (ClassName.EqualIgnoreCase("ControlJobType"))
     {
         this.Name = "ControlJobType";
         this.dataGridViewX1.DataSource = ControlJobType.FindAll();
     }
     if (ClassName.EqualIgnoreCase("DeviceType"))
     {
         this.Name = "DeviceType";
         this.dataGridViewX1.DataSource = DeviceType.FindAll();
     }
     if (ClassName.EqualIgnoreCase("FacilityType"))
     {
         this.Name = "FacilityType";
         this.dataGridViewX1.DataSource = FacilityType.FindAll();
     }
     if (ClassName.EqualIgnoreCase("ProtocalType"))
     {
         this.Name = "ProtocalType";
         this.dataGridViewX1.DataSource = ProtocalType.FindAll();
     }
     if (ClassName.EqualIgnoreCase("ShowDeviceType"))
     {
         this.Name = "ShowDeviceType";
         this.dataGridViewX1.DataSource = ShowDeviceType.FindAll();
     }
 }
        /// <summary>
        /// 初始化设备类型
        /// </summary>
        private void InitDeviceType()
        {
            var deviceTypeList = DeviceType.FindAll().ToList()
                                 .Where(dt => dt.Serialnum.StartsWith("control"))
                                 .ToList();

            //foreach (var deviceType in deviceTypeList)
            //{
            //    this.cbDeviceType.Items.Add(deviceType);
            //    this.cbDeviceType.DisplayMember = deviceType.Serialnum;
            //    this.cbDeviceType.ValueMember = deviceType.Name;
            //}
            if (deviceTypeList.Any() && deviceTypeList.Count > 0)
            {
                this.cbDeviceType.DataSource    = deviceTypeList;
                this.cbDeviceType.DisplayMember = "Name";
                this.cbDeviceType.ValueMember   = "Serialnum";
            }
        }
Example #6
0
 /// <summary>
 /// 获取所有的设备类型
 /// </summary>
 /// <returns></returns>
 public IEnumerable <DeviceType> Get()
 {
     return(DeviceType.FindAll());
 }