Esempio n. 1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public CommandViewTool()
        {
            InitializeComponent();

            commandsTree      = new TreeNode("Commands", IconFolderClosed, IconFolderOpen);
            toolBarsTree      = new TreeNode("Tool Bars", IconFolderClosed, IconFolderOpen);
            commandCollection = new NamedItemTreeCollection <Command>();

            // store the reference of the created tool:
            CustomAddInManager.LastCreatedPackageTool = this;
        }
Esempio n. 2
0
        private static void SerializeInfo(NamedItemTreeCollection <Command> folderCollection, TreeNode nodeCommands, int inactiveIcon, int activeIcon)
        {
            // enumerate all folders and generate their info:
            foreach (KeyValuePair <string, NamedItemTreeCollection <Command> > f in folderCollection.Folders)
            {
                TreeNode n = new TreeNode(f.Key, inactiveIcon, activeIcon);
                nodeCommands.Nodes.Add(n);

                // add all child elements:
                SerializeInfo(f.Value, n, inactiveIcon, activeIcon);
            }

            // add other elements:
            foreach (KeyValuePair <string, Command> c in folderCollection.Items)
            {
                TreeNode m = new TreeNode(c.Key, IconEventInactive, IconEventActive);
                m.Tag = c.Value;

                nodeCommands.Nodes.Add(m);
            }
        }