Exemple #1
0
        internal static int[] GetMenuItemID(IntPtr menu, IContextMenu contextMenu, string[] lookupCommands, MenuIDTypes returnType)
        {
            Dictionary <uint, MenuItemInfo> menuItemInfo = GetMenuItemInfo(menu, contextMenu);

            List <int> retVal = new List <int>();

            foreach (string lookupCommand in lookupCommands)
            {
                int foundID = -1;
                for (uint i = 0; i < menuItemInfo.Count; i++)
                {
                    if (menuItemInfo[i].Command == lookupCommand)
                    {
                        foundID = (int)(returnType == MenuIDTypes.RelativePosition ? i : menuItemInfo[i].CommandID);
                        break;
                    }
                }
                retVal.Add(foundID);
            }
            return(retVal.ToArray());
        }
        internal static int[] GetMenuItemID(IntPtr menu, IContextMenu contextMenu, string[] lookupCommands, MenuIDTypes returnType)
        {
            Dictionary<uint, MenuItemInfo> menuItemInfo = GetMenuItemInfo(menu, contextMenu);

            List<int> retVal = new List<int>();
            foreach (string lookupCommand in lookupCommands)
            {
                int foundID = -1;
                for (uint i = 0; i < menuItemInfo.Count; i++)
                    if (menuItemInfo[i].Command == lookupCommand)
                    {
                        foundID = (int)(returnType == MenuIDTypes.RelativePosition ? i : menuItemInfo[i].CommandID);
                        break;
                    }
                retVal.Add(foundID);
            }
            return retVal.ToArray();
        }
Exemple #3
0
        internal static int GetMenuItemID(IntPtr menu, IContextMenu contextMenu, string lookupCommand, MenuIDTypes returnType)
        {
            Dictionary <uint, MenuItemInfo> menuItemInfo = GetMenuItemInfo(menu, contextMenu);

            for (uint i = 0; i < menuItemInfo.Count; i++)
            {
                if (menuItemInfo[i].Command == lookupCommand)
                {
                    return((int)(returnType == MenuIDTypes.RelativePosition ? i : menuItemInfo[i].CommandID));
                }
            }

            return(-1);
        }
        internal static int GetMenuItemID(IntPtr menu, IContextMenu contextMenu, string lookupCommand, MenuIDTypes returnType)
        {
            Dictionary<uint, MenuItemInfo> menuItemInfo = GetMenuItemInfo(menu, contextMenu);
            for (uint i = 0; i < menuItemInfo.Count; i++)
                if (menuItemInfo[i].Command == lookupCommand)
                    return (int)(returnType == MenuIDTypes.RelativePosition ? i : menuItemInfo[i].CommandID);

            return -1;
        }