Exemple #1
0
        internal LocalizedToolStripMenuItem InitializedMenuItem()
        {
            if (MenuItem == null)
            {
                MenuItem = LocalizedToolStripMenuItem.CreateFrom(ContainerNode);
                UIMenuBuilder.BuildMenu(DropDownItemsActionHandler, MenuItem.DropDownItems);
                MenuItem.Visible          = UpdateMenu();
                MenuItem.DropDownOpening += (_, __) => UpdateMenu();
                MenuItem.Disposed        += (_, __) => MenuItem = null;
            }

            return(MenuItem);
        }
Exemple #2
0
        ToolStripMenuItem IUIMenuTreeVisitor <ToolStripMenuItem> .VisitContainer(UIMenuNode.Container container)
        {
            if (container.TextProvider == null && container.IconProvider == null)
            {
                return(null);
            }

            var menuItem = LocalizedToolStripMenuItem.CreateFrom(container);

            BuildMenu(container.Nodes, menuItem.DropDownItems);

            // No empty submenu items.
            if (menuItem.DropDownItems.Count == 0)
            {
                return(null);
            }

            return(menuItem);
        }