/// <summary> /// 初始化传感器设备列表 /// </summary> private void InitCollectDeviceListView() { this.listView2.Items.Clear(); List <SensorDeviceUnit> collectDeviceList = SensorDeviceUnit.FindAll(); foreach (var collectDevice in collectDeviceList) { var strings = new string[] { collectDevice.ModularDeviceName, collectDevice.Name }; var listViewItem = new ListViewItem(strings); listViewItem.Tag = collectDevice; this.listView2.Items.Add(listViewItem); } }
/// <summary> /// 初始化传感器设备(采集设备) /// </summary> private void InitSensorDeviceUnit() { List <SensorDeviceUnit> sensorDeviceUnitList = SensorDeviceUnit.FindAll(); //foreach (var sensorDeviceUnit in sensorDeviceUnitList) //{ // this.cbSensorDeviceUnit.Items.Add(sensorDeviceUnit); // this.cbSensorDeviceUnit.DisplayMember = sensorDeviceUnit.ID.ToString(); // this.cbSensorDeviceUnit.ValueMember = sensorDeviceUnit.Name; //} if (sensorDeviceUnitList.Count > 0) { this.cbSensorDeviceUnit.DataSource = sensorDeviceUnitList; this.cbSensorDeviceUnit.DisplayMember = "Name"; this.cbSensorDeviceUnit.ValueMember = "ID"; } }
/// <summary> /// 初始化采集设备列表 /// </summary> private void InitCollectDeviceListView() { this.listView1.Items.Clear(); List <SensorDeviceUnit> collectDeviceList = SensorDeviceUnit.FindAll(); foreach (var collectDevice in collectDeviceList) { var strings = new string[] { collectDevice.ID.ToString(), collectDevice.Name, collectDevice.ModularDeviceName.ToString(), collectDevice.SensorName.ToString(), collectDevice.Function.ToString(), collectDevice.OriginalValue.ToString(), collectDevice.ShowValue, collectDevice.ProcessedValue.ToString(), collectDevice.UpdateTime.ToString(), collectDevice.RegisterSize.ToString(), collectDevice.RegisterAddress.ToString(), collectDevice.Location }; var listViewItem = new ListViewItem(strings); listViewItem.Tag = collectDevice; this.listView1.Items.Add(listViewItem); } }