示例#1
0
        /// <summary>
        /// </summary>
        /// <param name = "menuEntry"></param>
        /// <param name = "menuUid"></param>
        /// <returns></returns>
        private MenuEntry getMenuEntryByUid(MenuEntry menuEntry, int menuUid)
        {
            MenuEntry menuEntryByUid = null;

            if (menuEntry.menuType() == GuiMenuEntry.MenuType.MENU)
            {
                MenuEntryMenu menuEntryMenu  = (MenuEntryMenu)menuEntry;
                IEnumerator   iMenuEntryMenu = menuEntryMenu.iterator();
                while (iMenuEntryMenu.MoveNext())
                {
                    MenuEntry menuEntryNext = (MenuEntry)iMenuEntryMenu.Current;
                    if (menuEntryNext.menuUid() == menuUid)
                    {
                        return(menuEntryNext);
                    }
                    if (menuEntryNext.menuType() == GuiMenuEntry.MenuType.MENU)
                    {
                        menuEntryByUid = getMenuEntryByUid(menuEntryNext, menuUid);
                        if (menuEntryByUid != null)
                        {
                            if (menuEntryByUid.menuUid() == menuUid)
                            {
                                return(menuEntryByUid);
                            }
                        }
                    }
                }
            }
            return(menuEntryByUid);
        }
示例#2
0
        /// <summary>
        ///   Gets the menu entry from its Uid.
        /// </summary>
        /// <param name = "menuUid">Uid whose corresponding menu entry is to be found</param>
        /// <returns></returns>
        public MenuEntry menuByUid(int menuUid)
        {
            MenuEntry   menuEntryByUid = null;
            IEnumerator iMgMenu        = menus.GetEnumerator();

            while (iMgMenu.MoveNext())
            {
                MgMenu      mgmenu     = (MgMenu)iMgMenu.Current;
                IEnumerator iMenuEntry = mgmenu.iterator();
                while (iMenuEntry.MoveNext())
                {
                    MenuEntry menuEntry = (MenuEntry)iMenuEntry.Current;
                    if (menuEntry.menuUid() == menuUid)
                    {
                        menuEntryByUid = menuEntry;
                        return(menuEntryByUid);
                    }
                    if (menuEntry.menuType() == GuiMenuEntry.MenuType.MENU)
                    {
                        menuEntryByUid = getMenuEntryByUid(menuEntry, menuUid);
                        if (menuEntryByUid != null)
                        {
                            if (menuEntryByUid.menuUid() == menuUid)
                            {
                                return(menuEntryByUid);
                            }
                        }
                    }
                }
            }
            return(menuEntryByUid);
        }