示例#1
0
        public static Menu CreateMenuFromActions(string name, IEnumerable<ActionItem> actions)
        {
            Menu menu = FindMenu(name);

            if (menu != null)
            {
                mgr.UnRegisterMenu(menu._Menu);
                Kernel._Global.ReleaseIMenu(menu._Menu);
                menu = null;
            }

            menu = new Menu();
            menu.Title = name;
            RegisterMenu(menu);

            foreach (var a in actions)
                menu.AddItem(new MenuItem(a));

            MenuItem item = new MenuItem();
            item.Title = name;
            item.SubMenu = menu;
            MainMenuBar.AddItem(item);
            UpdateMenuBar();
            return menu;
        }
示例#2
0
 public static void RegisterMenu(Menu menu)
 {
     mgr.RegisterMenu(menu._Menu, 0);
 }