public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { var types = CommunicateDeviceType.FindAll(); var names = new ArrayList(); if (types != null && types.Count > 0) { names.AddRange(types); } return(new StandardValuesCollection(names)); }
/// <summary> /// 初始化通讯设备类型列表 /// </summary> private void InitCommunicateDeviceTypeListView() { this.listView1.Items.Clear(); List <CommunicateDeviceType> communicateDeviceTypeList = CommunicateDeviceType.FindAll(); foreach (var communicateDeviceType in communicateDeviceTypeList) { var strings = new string[] { communicateDeviceType.ID.ToString(), communicateDeviceType.Name, communicateDeviceType.Remark }; var listViewItem = new ListViewItem(strings); listViewItem.Tag = communicateDeviceType; this.listView1.Items.Add(listViewItem); } }
/// <summary> /// 初始化通讯设备类型 /// </summary> private void InitCommunicateDeviceType() { List <CommunicateDeviceType> communicateDeviceTypeList = CommunicateDeviceType.FindAll(); //foreach (var communicateDeviceType in communicateDeviceTypeList) //{ // this.cbCommunicateDeviceType.Items.Add(communicateDeviceType); // this.cbCommunicateDeviceType.DisplayMember = communicateDeviceType.ID.ToString(); // this.cbCommunicateDeviceType.ValueMember = communicateDeviceType.Name; //} if (communicateDeviceTypeList.Count > 0) { this.cbCommunicateDeviceType.DataSource = communicateDeviceTypeList; this.cbCommunicateDeviceType.DisplayMember = "Name"; this.cbCommunicateDeviceType.ValueMember = "ID"; } }
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(); } }