예제 #1
0
        /// <summary>
        /// Loads a KML tree from data file to the tree view
        /// </summary>
        /// <param name="filename">The full path and filename of the data file to read</param>
        public void Load(string filename)
        {
            WarningsManager.BeforeTreeLoad();
            TreeManager.Load(filename);
            VesselsManager.Load(TreeManager);
            KerbalsManager.Load(TreeManager);
            WarningsManager.AfterTreeLoad();

            // Show warnings tab if there are any
            if (Syntax.Messages.Count > 0)
            {
                WarningsTab.Visibility = System.Windows.Visibility.Visible;
                Tabs.SelectedItem      = WarningsTab;
                WarningsManager.Focus();
            }
            else
            {
                if (Tabs.SelectedItem == WarningsTab)
                {
                    Tabs.SelectedItem = TreeTab;
                    TreeManager.Focus();
                }
                else
                {
                    IGuiManager mgr = GetActiveGuiManager();
                    if (mgr != null)
                    {
                        mgr.Focus();
                    }
                }
                WarningsTab.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
예제 #2
0
        /// <summary>
        /// Loads a KML tree from data file to the tree view
        /// </summary>
        /// <param name="filename">The full path and filename of the data file to read</param>
        public void Load(string filename)
        {
            Filename = filename;
            WarningsManager.BeforeTreeLoad();
            TreeManager.Load(filename);
            VesselsManager.Load(TreeManager);
            KerbalsManager.Load(TreeManager);
            WarningsManager.AfterTreeLoad();

            // Show warnings tab if there are any and its not a craft file
            if (!WarningsManager.IsEmpty && !FileIsCraft)
            {
                WarningsTab.Visibility = System.Windows.Visibility.Visible;
                Tabs.SelectedItem      = WarningsTab;
                WarningsManager.Focus();
            }
            else
            {
                WarningsTab.Visibility = System.Windows.Visibility.Collapsed;
            }

            // Show vessels and kerbals list if its not a craft file
            if (FileIsCraft)
            {
                VesselsTab.Visibility = System.Windows.Visibility.Collapsed;
                KerbalsTab.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                VesselsTab.Visibility = System.Windows.Visibility.Visible;
                KerbalsTab.Visibility = System.Windows.Visibility.Visible;
            }

            if (Tabs.SelectedItem is TabItem && (Tabs.SelectedItem as TabItem).Visibility != System.Windows.Visibility.Visible)
            {
                // Switch to another tab when hidden
                Tabs.SelectedItem = TreeTab;
                TreeManager.Focus();
            }

            IGuiManager mgr = GetActiveGuiManager();

            if (mgr != null)
            {
                mgr.Focus();
            }
        }