Exemple #1
0
        /// <summary>
        /// Gets the command with the specified Shortcut.
        /// </summary>
        /// <param name="commandShortcut">The shortcut of the command to get.</param>
        /// <returns>The command, or null if a command with the specified Shortcut cannot be found.</returns>
        public Command FindCommandWithShortcut(Keys commandShortcut)
        {
            RebuildCommandShortcutTable(true);

            // WinLive 293185: If the shortcut involves CTRL - (right) ALT key, ignore it.
            if (KeyboardHelper.IsCtrlRightAlt(commandShortcut))
            {
                return(null);
            }

            //	Return the command with the matching shortcut.
            Command command = (Command)commandShortcutTable[commandShortcut];

            if (command != null)
            {
                return(command);
            }

            Shortcut shortcut = KeyboardHelper.MapToShortcut(commandShortcut);

            if (shortcut != Shortcut.None && !ShouldIgnore(shortcut))
            {
                return((Command)commandShortcutTable[shortcut]);
            }

            return(null);
        }