private void FillPhysicalPortList() { if (instrument.Interface != null) { foreach (object obj in instrument.Interface) { if (obj is PhysicalInterfacePorts) { PhysicalInterfacePorts pip = obj as PhysicalInterfacePorts; if (pip.Port != null) { foreach (Port port in pip.Port) { //ListViewGroup grp = new ListViewGroup(port.name); //grp.Tag = port; //lvResourcePorts.Groups.Add(grp); //if (resource.Interface != null && resource.Interface.Ports != null) //{ // foreach (Port port in resource.Interface.Ports) // { ListViewItem lvi = new ListViewItem(port.name); //lvi.Group = grp; lvi.Tag = port; lvPhysicalPorts.Items.Add(lvi); SetListItemCheckState(port, lvi); // } //} } } } } } }
private void Load() { HardwareItemDescription hid = _item as HardwareItemDescription; if (hid != null) { Nodes.Add(hid.GetType().Name, hid.GetType().Name); List <object> ports = hid.Interface; if (ports != null) { foreach (object port in ports) { PhysicalInterfacePorts pip = port as PhysicalInterfacePorts; if (pip != null) { List <PhysicalInterfacePortsPort> pipps = pip.Port; if (pipps != null) { foreach (PhysicalInterfacePortsPort pipp in pipps) { string name = pipp.name; string direction = pipp.directionSpecified?pipp.direction.ToString():""; string type = pipp.typeSpecified ? pipp.type.ToString() : ""; Nodes[hid.GetType().Name].Nodes.Add(name, name + " " + direction + " " + type); Nodes[hid.GetType().Name].Nodes[name].Tag = pipp; } } } } } } }
public void DataToControls() { foreach (object obj in _physicalInterface.Items) { if (obj is PhysicalInterfaceConnectors) { _physicalInterfaceConnectors = obj as PhysicalInterfaceConnectors; } if (obj is PhysicalInterfacePorts) { _physicalInterfacePorts = obj as PhysicalInterfacePorts; } } DataToControls(_physicalInterface.Items); }