/// <summary>
 /// Selects the tree view item.
 /// </summary>
 /// <param name="Collection">The collection.</param>
 /// <param name="Value">The value.</param>
 /// <returns></returns>
 private TreeViewWithIcons SelectTreeViewItem(ItemCollection Collection, String Value)
 {
     if (Collection == null)
     {
         return(null);
     }
     foreach (TreeViewWithIcons Item in Collection)
     {
         /// Find in current
         if (Item.Tag.Equals(Value))
         {
             Item.IsSelected = true;
             return(Item);
         }
         /// Find in Childs
         if (Item.Items != null)
         {
             TreeViewWithIcons childItem = this.SelectTreeViewItem(Item.Items, Value);
             if (childItem != null)
             {
                 Item.IsExpanded = true;
                 return(childItem);
             }
         }
     }
     return(null);
 }
        private TreeViewWithIcons createTreeViewItem(String id, String name, NetworkStatus status)
        {
            TreeViewWithIcons item = new TreeViewWithIcons();

            item.Tag        = id;
            item.HeaderText = name;
            item.Icon       = CreateImage(getImageForStatus(status));
            return(item);
        }
 private void leftPaneDeviceTree_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (null == (selectedLeftPane = (TreeViewWithIcons)leftPaneDeviceTree.SelectedItem))
     {
         addSlaveMenuItem.IsEnabled     = false;
         deleteDeviceMenuItem.IsEnabled = false;
     }
     else
     {
         addSlaveMenuItem.IsEnabled     = true;
         deleteDeviceMenuItem.IsEnabled = true;
     }
 }
 private TreeViewWithIcons createTreeViewItem(String id, String name, NetworkStatus status)
 {
     TreeViewWithIcons item = new TreeViewWithIcons();
     item.Tag = id;
     item.HeaderText = name;
     item.Icon = CreateImage(getImageForStatus(status));
     return item;
 }
 private void leftPaneDeviceTree_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (null == (selectedLeftPane = (TreeViewWithIcons)leftPaneDeviceTree.SelectedItem))
     {
         addSlaveMenuItem.IsEnabled = false;
         deleteDeviceMenuItem.IsEnabled = false;
     }
     else
     {
         addSlaveMenuItem.IsEnabled = true;
         deleteDeviceMenuItem.IsEnabled = true;
     }
 }