コード例 #1
0
        public MenuAdapter(ContextMenu menu, WebActionNode model, ActionDispatcher actionDispatcher)
            : base(menu)
        {
            _menu = menu;

            if (model is WebDropDownButtonAction)
            {
                //TODO (CR May 2010): there's probably a more generic way to do this
                WebDropDownButtonAction a = model as WebDropDownButtonAction;
                foreach (WebActionNode node in a.DropDownActions)
                {
                    MenuItem menuItem = BuildMenuItem(node, actionDispatcher);
                    if (menuItem != null)
                    {
                        _menu.Items.Add(menuItem);
                    }
                }
            }
            else
            {
                foreach (WebActionNode node in model.Children)
                {
                    MenuItem menuItem = BuildMenuItem(node, actionDispatcher);
                    if (menuItem != null)
                    {
                        _menu.Items.Add(menuItem);
                    }
                }
            }
        }
コード例 #2
0
        internal static IPopup BuildContextMenu(WebActionNode model, ActionDispatcher actionDispatcher)
        {
            ContextMenu menu = new ContextMenu();

            return(new MenuAdapter(menu, model, actionDispatcher));
        }