private void ProcessHardwareItemResources()
{
var instrumentDescription = _hardwareItemDescription as InstrumentDescription;
var testEquipment = _hardwareItemDescription as TestEquipment;
if (instrumentDescription != null || testEquipment != null )
{
var g = new ListViewGroup( "Resources", "Resources" );
lvNetworkPaths.Groups.Add( g );
List<Resource> resourceList = null;
resourceList = instrumentDescription != null ? instrumentDescription.Resources : testEquipment.Resources;
if (resourceList != null)
{
foreach (Resource resource in resourceList)
{
Interface resouceInterface = resource.Interface;
if (resouceInterface != null)
{
List<Port> ports = resouceInterface.Ports;
if (ports != null)
{
foreach (Port port in ports)
{
var xpath = new StringBuilder( "//" );
xpath.Append( XPathManager.DeterminePathName( _hardwareItemDescription ) );
xpath.Append( "/" ).Append( XPathManager.DeterminePathName( resourceList ) );
xpath.Append( "/" ).Append( XPathManager.DeterminePathName( resource ) );
xpath.Append( "[@name=\"" )
.Append( resource.name )
.Append( "\"]" );
xpath.Append( "/" ).Append( XPathManager.DeterminePathName( resouceInterface ) );
xpath.Append( "/" ).Append( XPathManager.DeterminePathName( ports ) );
xpath.Append( "/" )
.Append( XPathManager.DeterminePathName( port ) );
xpath.Append( "[@name=\"" ).Append( port.name ).Append( "\"]" );
string pathValues = NetworkNode.ExtractPathValues( xpath.ToString() );
var lvi = new ListViewItem( pathValues );
lvi.Tag = xpath.ToString();
lvi.Group = g;
lvNetworkPaths.Items.Add( lvi );
}
}
}
}
}
}
}