예제 #1
0
        private void ChildWalk(ToolStripMenuItemElement _rootitem, TreeNode _node)
        {
            foreach (ToolStripMenuItemElement item in _rootitem.DropDownItems)
            {
                TreeNode node = new TreeNode();
                node.Tag = item.ID;
                node.Text = item.Text.Replace("&", ""); ;
                node.ToolTipText = item.ToolTipText;

                _node.Nodes.Add(node);
                if (item.DropDownItems.Count != 0)
                    ChildWalk(item, node);
            }
        }
예제 #2
0
        private void ExtendMenu()
        {
            //TODO: add menu items here, normally by calling the "Add" method on
            //		on the WorkItem.UIExtensionSites collection. For an example
            //		See: ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.2005Nov.cab/CAB/html/03-100-Showing%20UIElements.htm

            // Loads the menu items from menu.dat and put them into the menu strip, hooking
            // up the menu URIs for command dispatching.
            menuImporter.ParseData();
            foreach (MenuData._mainMenuRow row in context.menuData.Tables["_mainMenu"].Rows)
            {
                ToolStripMenuItemElement menuItem = new ToolStripMenuItemElement();
                string id = row.ID;
                menuItem.ID = row.ID;
                menuItem.Text = row.NAME;
                menuItem.ToolTipText = row.IsTIPNull() == true ? "" : row.TIP;
                menuItem.CommandName = row.CMDNAME;

                if (!row.IsCMD1Null())
                {
                    if (menuItem.CommandName != "defaultClick")
                        WorkItem.Commands[menuItem.CommandName].AddInvoker(menuItem, "Click");
                    else
                        menuItem.Click += new EventHandler(menuItem_Click);
                }

                menuItem.MouseEnter += new EventHandler(onMenuItemEnter);
                menuItem.MouseLeave += new EventHandler(onMenuItemLeave);

                string site = GetUIExtensionSite(WorkItem, menuItem.ID);
                if (site == string.Empty)
                    WorkItem.RootWorkItem.UIExtensionSites[UIExtensionSiteNames.MainMenu].Add(menuItem);
                else
                    WorkItem.RootWorkItem.UIExtensionSites[site].Add(menuItem);

                WorkItem.RootWorkItem.UIExtensionSites.RegisterSite(menuItem.ID, menuItem.DropDownItems);
            }
            //if (context.terminate)
            //{
            //    MessageBox.Show(ErrorNames.Err4, "Acotwin");
            //    OnFileExitClick(this, EventArgs.Empty);
            //}
            //else
            context.Reload();
        }