private string CreateMappingName( Mapping mapping )
 {
     String mappingName = "Mapping ";
     List<Network> map = mapping.Map.ToList();
     if (map.Count > 0)
     {
         var sb = new StringBuilder();
         List<NetworkNode> nodes = map[0].Node.ToList();
         foreach (NetworkNode node in nodes)
         {
             sb.Append( GetMappingName( node ) );
             sb.Append( SEPARATOR );
         }
         if (sb.ToString().EndsWith( SEPARATOR ))
             sb.Length = sb.Length - SEPARATOR.Length;
         mappingName = sb.ToString();
     }
     return mappingName;
 }
 private void ControlsToData()
 {
     if (CapabilityMapMode)
     {
         if (lvList.Items.Count == 0)
         {
             if( _mapping != null )
                 _mapping.Map = null;
         }
         else
         {
             if (_mapping == null)
                 _mapping = new Mapping();
             if (_mapping.Map == null)
                 _mapping.Map = new List<Network>();
             _mapping.Map.Clear();
             foreach (ListViewItem lvi in lvList.Items)
                 _mapping.Map.Add(lvi.Tag as Network);
         }
     }
     else if (_hardwareItemDescription != null)
     {
         if (lvList.Items.Count == 0)
         {
             _hardwareItemDescription.NetworkList = null;
         }
         else
         {
             if (_hardwareItemDescription.NetworkList == null)
                 _hardwareItemDescription.NetworkList = new List<Network>();
             _hardwareItemDescription.NetworkList.Clear();
             foreach (ListViewItem lvi in lvList.Items)
                 _hardwareItemDescription.NetworkList.Add( lvi.Tag as Network );
         }
     }
 }
        private void AddMappingItem( Mapping mapping )
        {
            if (mapping == null)
                return;

            var mappingName = CreateMappingName( mapping );
            var item = new ListViewItem( mapping.ToString() );
            item.Tag = mapping;
            lvList.Items.Add( item );
        }