예제 #1
0
        /// <summary>
        /// Select should be called from within other GuiManagers
        /// and wants this manager to get avtive and go to given item.
        /// </summary>
        /// <param name="item">The KmlItem to select</param>
        /// <returns>Whether item was found or not</returns>
        public bool Select(KmlItem item)
        {
            KmlNode masterNode = item is KmlNode ? (KmlNode)item : item.Parent;

            foreach (GuiKerbalsNode node in KerbalsList.Items)
            {
                if (node.DataKerbal == masterNode)
                {
                    // Force a refreh, by causing SelectionChanged to invoke
                    KerbalsList.SelectedItem = null;
                    KerbalsList.SelectedItem = node;
                    KerbalsList.ScrollIntoView(node);
                    Focus();
                    if (item is KmlAttrib)
                    {
                        foreach (GuiTreeAttrib attrib in KerbalsDetails.Items)
                        {
                            if (attrib.DataAttrib == item)
                            {
                                attrib.IsSelected = true;
                                KerbalsDetails.Focus();
                            }
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
 /// <summary>
 /// Select should be called from within other GuiManagers
 /// and wants this manager to get avtive and go to given item.
 /// </summary>
 /// <param name="item">The KmlItem to select</param>
 public void Select(KmlItem item)
 {
     foreach (GuiKerbalsNode node in KerbalsList.Items)
     {
         if (node.DataKerbal == item)
         {
             KerbalsList.SelectedItem = node;
             KerbalsList.ScrollIntoView(node);
             Focus();
             return;
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Select should be called from within other GuiManagers
 /// and wants this manager to get avtive and go to given item.
 /// </summary>
 /// <param name="item">The KmlItem to select</param>
 public void Select(KmlItem item)
 {
     foreach (GuiKerbalsNode node in KerbalsList.Items)
     {
         if (node.DataKerbal == item)
         {
             // Force a refreh, by causing SelectionChanged to invoke
             KerbalsList.SelectedItem = null;
             KerbalsList.SelectedItem = node;
             KerbalsList.ScrollIntoView(node);
             Focus();
             return;
         }
     }
 }
예제 #4
0
 /// <summary>
 /// Some key was pressed.
 /// </summary>
 public void CommandExec(string Command)
 {
     if (KerbalsDetails.IsKeyboardFocusWithin && KerbalsDetails.SelectedItem is GuiTreeAttrib)
     {
         if (Command == "Enter")
         {
             // Enter the TextBox for value editing
             TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next);
             (KerbalsDetails.SelectedItem as ListViewItem).MoveFocus(request);
         }
         else if (Command == "Escape" || Command == "Left")
         {
             // Get back to TreeView
             KerbalsList.Focus();
             (KerbalsList.SelectedItem as ListViewItem).Focus();
         }
         else
         {
             (KerbalsDetails.SelectedItem as GuiTreeAttrib).CommandExec(Command);
         }
     }
     else if (KerbalsList.IsKeyboardFocusWithin && KerbalsList.SelectedItem is GuiKerbalsNode)
     {
         if (Command == "Enter" || Command == "Right")
         {
             // Switch to attributes
             KerbalsDetails.Focus();
             KmlItem item = GetSelectedItem();
             if (item is KmlNode)
             {
                 KmlNode node = (KmlNode)item;
                 if (node.Attribs.Count > 0)
                 {
                     Select(node.Attribs[0]);
                     (KerbalsDetails.SelectedItem as ListViewItem).Focus();
                 }
             }
         }
         else
         {
             (KerbalsList.SelectedItem as GuiKerbalsNode).CommandExec(Command);
         }
     }
 }