/// <summary>
        /// </summary>
        /// <param name="page"></param>
        /// <param name="parentPageReference"></param>
        /// <param name="asRoot">only one page can be set as the root page (for the GitExt and Plugin root node)</param>
        public void AddSettingsPage(ISettingsPage page, SettingsPageReference parentPageReference, bool asRoot = false)
        {
            TreeNode node;
            if (parentPageReference == null)
            {
                // add one of the root nodes (e. g. "Git Extensions" or "Plugins"
                node = treeView1.Nodes.Add(page.GetTitle());
            }
            else
            {
                if (asRoot)
                {
                    // e. g. to set the Checklist on the "Git Extensions" node
                    node = _Pages2NodeMap[parentPageReference];
                }
                else
                {
                    TreeNode parentNode;
                    if (!_Pages2NodeMap.TryGetValue(parentPageReference, out parentNode))
                        throw new ArgumentException("You have to add parent page first: " + parentPageReference);

                    node = parentNode.Nodes.Add(page.GetTitle());
                }
            }

            node.Tag = page;
            _Pages2NodeMap.Add(page.PageReference, node);
            _SettingsPages.Add(page);
        }
示例#2
0
        private TreeNode AddPage(TreeNodeCollection treeNodeCollection, ISettingsPage page, Image icon)
        {
            var node = treeNodeCollection.Add(page.GetTitle());

            if (icon == null)
            {
                return(node);
            }

            treeView1.ImageList.Images.Add(icon);
            node.ImageIndex = node.SelectedImageIndex = treeView1.ImageList.Images.Count - 1;
            return(node);
        }
示例#3
0
        public void AddSettingsPage(ISettingsPage page, SettingsPageReference parentPageReference)
        {
            TreeNode node;

            if (parentPageReference == null)
            {
                node = treeView1.Nodes.Add(page.GetTitle());
            }
            else
            {
                TreeNode parentNode;
                if (!_Pages2NodeMap.TryGetValue(parentPageReference, out parentNode))
                {
                    throw new ArgumentException("You have to add parent page first: " + parentPageReference);
                }

                node = parentNode.Nodes.Add(page.GetTitle());
            }

            node.Tag = page;
            _Pages2NodeMap.Add(page.PageReference, node);
            _SettingsPages.Add(page);
        }
        public void AddSettingsPage(ISettingsPage page, SettingsPageReference parentPageReference)
        {
            TreeNode node;
            if (parentPageReference == null)
                node = treeView1.Nodes.Add(page.GetTitle());
            else
            {
                TreeNode parentNode;
                if (!_Pages2NodeMap.TryGetValue(parentPageReference, out parentNode))
                    throw new ArgumentException("You have to add parent page first: " + parentPageReference.ToString());

                node = parentNode.Nodes.Add(page.GetTitle());
            }

            node.Tag = page;
            _Pages2NodeMap.Add(page.PageReference, node);
            _SettingsPages.Add(page);
        }