Esempio n. 1
0
        public OptionsPanel SwitchPanel(String optionCategory)
        {
            try
            {
                OptionsPanelPath.Text = "";

                if (_Panels.Count > 0)
                {
                    OptionsPanel pn = null;

                    for (int i = 0; i < _Panels.Count; i++)
                    {
                        if (_Panels[i].CategoryPath == optionCategory)
                        {
                            pn = _Panels[i];
                            break;
                        }
                    }

                    if (pn != null)
                    {
                        String displayName = pn.DisplayName;

                        String[][] lpaths = GetPaths(optionCategory);
                        String[]   paths  = lpaths[0];

                        if (paths.Length > 1)
                        {
                            TreeNode[] search = CatTree.Nodes.Find(paths[0], false);

                            if (search != null && search.Length > 0)
                            {
                                OptionsPanelPath.Text += search[0].Text + " » ";

                                int i   = 1;
                                int sub = paths.Length - 1;
                                for (; i < sub; i++)
                                {
                                    search = search[0].Nodes.Find(paths[i], false);

                                    if (search != null && search.Length > 0)
                                    {
                                        OptionsPanelPath.Text += search[0].Text + " » ";
                                    }
                                }
                            }
                        }

                        OptionsPanelPath.Text += displayName;

                        if (this.OptionPanelContainer.Controls.Count == 0 || !OptionPanelContainer.Controls[0].Equals(pn))
                        {
                            this.OptionPanelContainer.Controls.Clear();
                            this.OptionPanelContainer.Controls.Add(pn);

                            _currentPanel.Visible = false;
                            pn.Visible            = true;
                        }


                        _currentPanel = pn;
                        return(pn);
                    }
                }
                _currentPanel = null;
                return(null);
            }
            catch
            {
                _currentPanel = null;
                return(null);
            }
        }
Esempio n. 2
0
 public OptionsPanelEventArgs(OptionsPanel panel)
 {
     _Panel = panel;
 }
Esempio n. 3
0
        private void AddPanel(OptionsPanel panel)
        {
            String optionCategory = panel.CategoryPath;
            String displayName    = panel.DisplayName;

            String[][] lpaths = GetPaths(optionCategory);
            String[]   paths  = lpaths[0];
            String[]   labs   = lpaths[1];

            TreeNode pnode = null;
            TreeNode nnode = null;

            if (paths.Length > 1)
            {
                TreeNode[] search = CatTree.Nodes.Find(paths[0], false);

                if (search != null && search.Length > 0)
                {
                    pnode = search[0];
                }
                else
                {
                    CatTree.Nodes.Add(paths[0], labs[0], paths[0], paths[0]);
                    pnode = CatTree.Nodes[CatTree.Nodes.Count - 1];
                }

                int i   = 1;
                int sub = paths.Length - 1;
                for (; i < sub; i++)
                {
                    search = pnode.Nodes.Find(paths[i], false);

                    if (search != null && search.Length > 0)
                    {
                        pnode = search[0];
                    }
                    else
                    {
                        pnode.Nodes.Add(paths[i], labs[i], String.Join("\\", paths, 0, i + 1), String.Join("\\", paths, 0, i + 1));
                        pnode = pnode.Nodes[pnode.Nodes.Count - 1];
                    }
                }

                if (i < sub)
                {
                    pnode = null;
                }
            }

            if (pnode != null)
            {
                nnode                  = new TreeNode(displayName);
                nnode.Name             = optionCategory;
                nnode.ImageKey         = String.Join("\\", paths);
                nnode.SelectedImageKey = String.Join("\\", paths);
                pnode.Nodes.Add(nnode);

                if (panel != null)
                {
                    panel.OptionsChanged += new EventHandler(panel_OptionsChanged);
                    panel.Dock            = DockStyle.Fill;
                    panel.PanelAdded(this);

                    EnableDescrControl(panel);
                }
            }
            else if (paths.Length == 1)
            {
                nnode      = new TreeNode(displayName);
                nnode.Name = optionCategory;
                CatTree.Nodes.Add(nnode);

                if (panel != null)
                {
                    panel.OptionsChanged += new EventHandler(panel_OptionsChanged);
                    panel.Dock            = DockStyle.Fill;
                    panel.PanelAdded(this);

                    EnableDescrControl(panel);
                }
            }

            CatTree.ExpandAll();
        }