Esempio n. 1
0
 /// <summary>
 /// Selects the given item in the tree view or in the list, the item fits into.
 /// If called when tree is active it will switch to the list when possible.
 /// Otherwise when list is active it will switch to the tree view.
 /// </summary>
 /// <param name="item">The KmlItem to select</param>
 public void Select(KmlItem item)
 {
     if (item is KmlVessel)
     {
         if (Tabs.SelectedItem == TreeTab)
         {
             Tabs.SelectedItem = VesselsTab;
             VesselsManager.Select(item);
         }
         else
         {
             Tabs.SelectedItem = TreeTab;
             TreeManager.Select(item);
         }
     }
     else if (item is KmlKerbal)
     {
         if (Tabs.SelectedItem == TreeTab)
         {
             Tabs.SelectedItem = KerbalsTab;
             KerbalsManager.Select(item);
         }
         else
         {
             Tabs.SelectedItem = TreeTab;
             TreeManager.Select(item);
         }
     }
     //else if (item is KmlNode)
     //{
     //    KmlNode node = (KmlNode)item;
     //    if (node != null)
     //    {
     //        Select(node.Parent);
     //    }
     //}
     else
     {
         Tabs.SelectedItem = TreeTab;
         TreeManager.Select(item);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Selects the given item in the tree view or in the list, the item fits into.
 /// If called when tree is active it will switch to the list when possible.
 /// Otherwise when list is active it will switch to the tree view.
 /// </summary>
 /// <param name="item">The KmlItem to select</param>
 /// <returns>Whether item was found or not</returns>
 public bool Select(KmlItem item)
 {
     if (item is KmlVessel)
     {
         KmlVessel vessel = (KmlVessel)item;
         if (Tabs.SelectedItem == TreeTab && vessel.Origin == KmlVessel.VesselOrigin.Flightstate)
         {
             Tabs.SelectedItem = VesselsTab;
             return(VesselsManager.Select(vessel));
         }
         else
         {
             Tabs.SelectedItem = TreeTab;
             return(TreeManager.Select(vessel));
         }
     }
     else if (item is KmlKerbal)
     {
         KmlKerbal kerbal = (KmlKerbal)item;
         if (Tabs.SelectedItem == TreeTab && kerbal.Origin == KmlKerbal.KerbalOrigin.Roster)
         {
             Tabs.SelectedItem = KerbalsTab;
             return(KerbalsManager.Select(kerbal));
         }
         else
         {
             Tabs.SelectedItem = TreeTab;
             return(TreeManager.Select(kerbal));
         }
     }
     else
     {
         Tabs.SelectedItem = TreeTab;
         return(TreeManager.Select(item));
     }
 }