public static void Save( string uuid, Capabilities capabilities )
 {
     SignalDAO dao = new SignalDAO();
     List<object> items = capabilities.Items;
     if (items != null)
     {
         foreach (object item in items)
         {
             Capability capability = item as Capability;
             DocumentReference documentReference = item as DocumentReference;
             if (capability != null)
                 ProcessCapability(uuid, capability);
             if( documentReference != null )
                 ProcessDocumentReference(uuid, documentReference);
         }
     }
 }
 private void ControlsToData()
 {
     if (HasCapabilities())
     {
         _capabilities = null;
     }
     else
     {
         if (_capabilities == null)
             _capabilities = new Capabilities();
         _capabilities.Items = capabilityListControl1.CapabilityItems;
         _capabilities.CapabilityMap = mappingListControl1.Mappings;
     }
 }
 public static bool LoadFromFile(string fileName, out Capabilities obj)
 {
     Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an Capabilities object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output Capabilities 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 Capabilities obj, out Exception exception)
 {
     exception = null;
     obj = default(Capabilities);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string input, out Capabilities obj)
 {
     Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an Capabilities object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output Capabilities 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 Capabilities obj, out Exception exception)
 {
     exception = null;
     obj = default(Capabilities);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /**
  * Call to Add Capabilities to the selection list view. Each item
  * in the list will hold an XPath representation of the Capabilities.
  */
 private void ProcessCapabilitites( Capabilities capabilities )
 {
     if (capabilities != null)
     {
         var g = new ListViewGroup( "Capabilities", "Capabilities" );
         lvNetworkPaths.Groups.Add( g );
         if (capabilities.Items != null )
         {
             foreach (object item in capabilities.Items)
             {
                 var capability = item as Capability;
                 if (capability != null)
                 {
                     Interface capabilityInterface = capability.Interface;
                     if (capabilityInterface != null)
                     {
                         List<Port> ports = capabilityInterface.Ports;
                         if (ports != null)
                         {
                             foreach (Port port in ports)
                             {
                                 var xpath = new StringBuilder( "//" );
                                 xpath.Append( XPathManager.DeterminePathName( _hardwareItemDescription ) );
                                 xpath.Append( "/" ).Append( XPathManager.DeterminePathName( capabilities ) );
                                 xpath.Append( "/" ).Append( XPathManager.DeterminePathName( capability ) );
                                 xpath.Append( "[@name=\"" )
                                      .Append( capability.name )
                                      .Append( "\"]" );
                                 xpath.Append( "/" )
                                      .Append( XPathManager.DeterminePathName( capabilityInterface ) );
                                 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 );
                             }
                         }
                     }
                 }
             }
         }
     }
 }