/// <summary> /// Gets the command with the specified CommandBarButtonContextMenuAcceleratorMnemonic. /// </summary> /// <param name="acceleratorMnemonic">The CommandBarButtonContextMenuAcceleratorMnemonic of the command to get.</param> /// <returns>The command, or null if a command with the specified CommandBarButtonContextMenuAcceleratorMnemonic cannot be found.</returns> public Command FindCommandWithCommandBarButtonContextMenuAcceleratorMnemonic(AcceleratorMnemonic acceleratorMnemonic) { // If the CommandBarButtonContextMenuAcceleratorMnemonic table has not been built, build it. if (commandBarButtonContextMenuAcceleratorMnemonicTable == null) { // Instantiate the CommandBarButtonContextMenuAcceleratorMnemonic table. commandBarButtonContextMenuAcceleratorMnemonicTable = new Hashtable(); // Rebuild the CommandBarButtonContextMenuAcceleratorMnemonic table. RebuildCommandBarButtonContextMenuAcceleratorMnemonicTable(); } // Return the command with the specified CommandBarButtonContextMenuAcceleratorMnemonic. return((Command)commandBarButtonContextMenuAcceleratorMnemonicTable[acceleratorMnemonic]); }
/// <summary> /// Gets the command with the specified AcceleratorMnemonic. /// </summary> /// <param name="acceleratorMnemonic">The AcceleratorMnemonic of the command to get.</param> /// <returns>The command, or null if a command with the specified AcceleratorMnemonic cannot be found.</returns> public Command FindCommandWithAcceleratorMnemonic(AcceleratorMnemonic acceleratorMnemonic) { // If the AcceleratorMnemonic table has not been built, build it. if (acceleratorMnemonicTable == null) { // Instantiate the AcceleratorMnemonic table. acceleratorMnemonicTable = new Hashtable(); // Rebuild the AcceleratorMnemonic table. RebuildAcceleratorMnemonicTable(); } // Return the command with the specified AcceleratorMnemonic. return((Command)acceleratorMnemonicTable[acceleratorMnemonic]); }
/// <summary> /// Processes a CmdKey for Command.CommandBarButtonContextMenuAcceleratorMnemonic matches. /// </summary> /// <param name="keyData">Specifies key codes and modifiers and process.</param> /// <returns>true if the Keys value was processed; otherwise, false.</returns> public bool ProcessCmdKeyCommandBarButtonContextMenuAcceleratorMnemonic(Keys keyData) { // Attempt to process the Keys value as a Command.CommandBarButtonContextMenuAcceleratorMnemonic. AcceleratorMnemonic acceleratorMnemonic = KeyboardHelper.MapToAcceleratorMnemonic(keyData); if (acceleratorMnemonic != AcceleratorMnemonic.None) { Command command = FindCommandWithCommandBarButtonContextMenuAcceleratorMnemonic(acceleratorMnemonic); if (command != null) { if (command.On && command.Enabled) { command.PerformShowCommandBarButtonContextMenu(); return(true); } } } // We did not process the accelerator. return(false); }
/// <summary> /// Gets the command with the specified CommandBarButtonContextMenuAcceleratorMnemonic. /// </summary> /// <param name="acceleratorMnemonic">The CommandBarButtonContextMenuAcceleratorMnemonic of the command to get.</param> /// <returns>The command, or null if a command with the specified CommandBarButtonContextMenuAcceleratorMnemonic cannot be found.</returns> public Command FindCommandWithCommandBarButtonContextMenuAcceleratorMnemonic(AcceleratorMnemonic acceleratorMnemonic) { // If the CommandBarButtonContextMenuAcceleratorMnemonic table has not been built, build it. if (commandBarButtonContextMenuAcceleratorMnemonicTable == null) { // Instantiate the CommandBarButtonContextMenuAcceleratorMnemonic table. commandBarButtonContextMenuAcceleratorMnemonicTable = new Hashtable(); // Rebuild the CommandBarButtonContextMenuAcceleratorMnemonic table. RebuildCommandBarButtonContextMenuAcceleratorMnemonicTable(); } // Return the command with the specified CommandBarButtonContextMenuAcceleratorMnemonic. return (Command)commandBarButtonContextMenuAcceleratorMnemonicTable[acceleratorMnemonic]; }
/// <summary> /// Gets the command with the specified AcceleratorMnemonic. /// </summary> /// <param name="acceleratorMnemonic">The AcceleratorMnemonic of the command to get.</param> /// <returns>The command, or null if a command with the specified AcceleratorMnemonic cannot be found.</returns> public Command FindCommandWithAcceleratorMnemonic(AcceleratorMnemonic acceleratorMnemonic) { // If the AcceleratorMnemonic table has not been built, build it. if (acceleratorMnemonicTable == null) { // Instantiate the AcceleratorMnemonic table. acceleratorMnemonicTable = new Hashtable(); // Rebuild the AcceleratorMnemonic table. RebuildAcceleratorMnemonicTable(); } // Return the command with the specified AcceleratorMnemonic. return (Command)acceleratorMnemonicTable[acceleratorMnemonic]; }