private void ControlsToData()
 {
     if (port == null)
         port = new PhysicalInterfacePortsPort();
     Port tempPort = portControl.Port;
     if (tempPort != null)
     {
         port.direction = tempPort.direction;
         port.directionSpecified = tempPort.directionSpecified;
         port.Extension = tempPort.Extension;
         port.name = tempPort.name;
         port.type = tempPort.type;
         port.typeSpecified = tempPort.typeSpecified;
         connectorLocationPinListControl.Connectors = connectors;
         if (connectorLocationPinListControl.ConnectorLocations != null
             && connectorLocationPinListControl.ConnectorLocations.Count > 0)
             port.ConnectorPins = connectorLocationPinListControl.ConnectorLocations;
         else
             port.ConnectorPins = null;
         //TODO: Address if we start handling Extentions
         port.Extension = null;
     }
 }
 private void DataToControls()
 {
     this.physicalInterfacePortControl.Port = port;
 }
 public void AddPort(PhysicalInterfacePortsPort port)
 {
     String name = port.name;
     int pinCount = 0;
     if (port.ConnectorPins != null)
         pinCount = port.ConnectorPins.Count;
     String directionText = port.directionSpecified ? port.direction.ToString() : "";
     String typeText = port.typeSpecified ? port.type.ToString() : "";
     var item = new ListViewItem(name);
     item.SubItems.Add(directionText);
     item.SubItems.Add(typeText);
     item.SubItems.Add("" + pinCount);
     item.Tag = port;
     Items.Add(item);
 }
 private void ControlsToData()
 {
     port = this.physicalInterfacePortControl.Port;
 }
 public static bool LoadFromFile(string fileName, out PhysicalInterfacePortsPort obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an PhysicalInterfacePortsPort object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output PhysicalInterfacePortsPort 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 PhysicalInterfacePortsPort obj, out System.Exception exception)
 {
     exception = null;
     obj = default(PhysicalInterfacePortsPort);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string input, out PhysicalInterfacePortsPort obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an PhysicalInterfacePortsPort object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output PhysicalInterfacePortsPort 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 PhysicalInterfacePortsPort obj, out System.Exception exception)
 {
     exception = null;
     obj = default(PhysicalInterfacePortsPort);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 //--------------------------------------------------//
 //--- Called when the add port button is clicked ---//
 //--------------------------------------------------//
 private void btnAddPort_Click( object sender, EventArgs e )
 {
     var port = new PhysicalInterfacePortsPort();
     var form = new PhysicalInterfacePortForm( _physicalInterfaceConnectors );
     if (DialogResult.OK == form.ShowDialog())
     {
         lvPorts.AddPort( form.Port );
         //if (_physicalInterfacePorts.Port == null)
         //    _physicalInterfacePorts.Port = new List<PhysicalInterfacePortsPort>();
         //_physicalInterfacePorts.Port.Add( form.Port );
     }
 }