/// <summary> /// This method supplies information about a command's status. At this point all /// commands are supported and visible. /// </summary> /// <param name="itemIds"> /// Array of identifiers for the items in the data view hierarchy on which this /// command should be invoked. /// </param> /// <param name="command"> /// The OleCommand object representing the command to invoke. /// </param> /// <param name="textType"> /// The OleCommandTextType object instance for the specified command. /// </param> /// <param name="status"> /// The OleCommandStatus object instance for the specified command. /// </param> /// <returns> /// Returns an OleCommandStatus object instance representing the status returned by the specified commands. /// /// </returns> public override OleCommandStatus GetCommandStatus( int[] itemIds, OleCommand command, OleCommandTextType textType, OleCommandStatus status) { if (command == null) { throw new ArgumentNullException("command"); } if (status == null) { throw new ArgumentNullException("status"); } OleCommandStatus result = new OleCommandStatus(); // Get command handler instance ICommand commandHandler = CommandFactory.Instance.CreateCommandHandler(command.GroupGuid, command.CommandId); if (commandHandler == null) { return(base.GetCommandStatus(itemIds, command, textType, status)); } result.Supported = true; // Determine visibility if (!commandHandler.GetIsVisible(Hierarchy, itemIds)) { result.Visible = false; return(result); } result.Visible = true; result.Enabled = true; // TODO: Find out why this doesn't work at all! // Localize text if possible string localizedText = commandHandler.GetText(Hierarchy, itemIds); if (!String.IsNullOrEmpty(localizedText)) { result.Text = localizedText; } return(result); }
public void AddChoice(ICommand command) { _choices.Add(new Choice(_choices.Count + 1, command.GetText(), command)); }