/// <summary> /// Registers a command for the command client</summary> /// <param name="commandService">Command service</param> /// <param name="commandTag">Command's unique ID</param> /// <param name="menuTag">Containing menu's unique ID, or null</param> /// <param name="groupTag">Containing menu group's unique ID, or null</param> /// <param name="menuText">Command text as it appears in menu</param> /// <param name="description">Command description</param> /// <param name="shortcut">Command shortcut, or Keys.None if none</param> /// <param name="imageName">Text identifying image, or null if none</param> /// <param name="client">Client that performs command</param> /// <returns>CommandInfo object describing command</returns> public static CommandInfo RegisterCommand( this ICommandService commandService, object commandTag, object menuTag, object groupTag, string menuText, string description, System.Windows.Forms.Keys shortcut, string imageName, ICommandClient client) { CommandInfo info = new CommandInfo(commandTag, menuTag, groupTag, menuText, description, KeysInterop.ToAtf(shortcut), imageName); commandService.RegisterCommand(info, client); return(info); }
/// <summary> /// Processes the key as a command shortcut</summary> /// <param name="commandService">Command service</param> /// <param name="key">Key to process</param> /// <returns>True iff the key was processed as a command shortcut</returns> static public bool ProcessKey(this ICommandService commandService, System.Windows.Forms.Keys key) { return(commandService.ProcessKey(KeysInterop.ToAtf(key))); }