protected void ControlsToData()
 {
     if (lvList.Items.Count > 0)
     {
         if (_terminalBlocks == null)
             _terminalBlocks = new TestEquipmentTerminalBlocks();
         _terminalBlocks.TerminalBlock = new List<TestEquipmentTerminalBlocksTerminalBlock>();
         foreach (ListViewItem lvi in lvList.Items)
         {
             var termBlock = (TestEquipmentTerminalBlocksTerminalBlock)lvi.Tag;
             _terminalBlocks.TerminalBlock.Add(termBlock);
         }
     }
     else
     {
         _terminalBlocks = null;
     }
 }
 public static bool LoadFromFile(string fileName, out TestEquipmentTerminalBlocks obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TestEquipmentTerminalBlocks object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TestEquipmentTerminalBlocks object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out TestEquipmentTerminalBlocks obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestEquipmentTerminalBlocks);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string input, out TestEquipmentTerminalBlocks obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an TestEquipmentTerminalBlocks object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TestEquipmentTerminalBlocks object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out TestEquipmentTerminalBlocks obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestEquipmentTerminalBlocks);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /**
  * Call to Add Terminal Blocks to the selection list view. Each item
  * in the list will hold an XPath representation of the Terminal Blocks.
  */
 private void ProcessTerminalBlocks( TestEquipmentTerminalBlocks terminalBlocks )
 {
     if (terminalBlocks != null)
     {
         var g = new ListViewGroup( "Terminal Blocks", "Terminal Blocks" );
         lvNetworkPaths.Groups.Add( g );
         foreach (TestEquipmentTerminalBlocksTerminalBlock terminalBlock in terminalBlocks.TerminalBlock)
         {
             Interface tbInterface = terminalBlock.Interface;
             if (tbInterface != null)
             {
                 List<Port> ports = tbInterface.Ports;
                 if (ports != null)
                 {
                     foreach (Port port in ports)
                     {
                         var xpath = new StringBuilder( "//" );
                         xpath.Append( XPathManager.DeterminePathName( _hardwareItemDescription ) );
                         xpath.Append( "/" ).Append( XPathManager.DeterminePathName( terminalBlocks ) );
                         xpath.Append( "/" ).Append( XPathManager.DeterminePathName( terminalBlock ) );
                         xpath.Append( "[@name=\"" ).Append( terminalBlock.name ).Append( "\"]" );
                         xpath.Append( "/" ).Append( XPathManager.DeterminePathName( tbInterface ) );
                         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 );
                     }
                 }
             }
         }
     }
 }