Compartilhar via


CommandHandlerExtensions.ExecuteCommand<T> Method

Definition

Called to execute the command.

public:
generic <typename T>
 where T : Microsoft::VisualStudio::Commanding::CommandArgs[System::Runtime::CompilerServices::Extension]
 static void ExecuteCommand(Microsoft::VisualStudio::Commanding::ICommandHandler ^ commandHandler, T args, Action ^ nextCommandHandler, Microsoft::VisualStudio::Commanding::CommandExecutionContext ^ executionContext);
public static void ExecuteCommand<T> (this Microsoft.VisualStudio.Commanding.ICommandHandler commandHandler, T args, Action nextCommandHandler, Microsoft.VisualStudio.Commanding.CommandExecutionContext executionContext) where T : Microsoft.VisualStudio.Commanding.CommandArgs;
static member ExecuteCommand : Microsoft.VisualStudio.Commanding.ICommandHandler * 'T * Action * Microsoft.VisualStudio.Commanding.CommandExecutionContext -> unit (requires 'T :> Microsoft.VisualStudio.Commanding.CommandArgs)
<Extension()>
Public Sub ExecuteCommand(Of T As CommandArgs) (commandHandler As ICommandHandler, args As T, nextCommandHandler As Action, executionContext As CommandExecutionContext)

Type Parameters

T

Parameters

commandHandler
ICommandHandler

A command handler to execute the command.

args
T

The CommandArgs arguments for the command.

nextCommandHandler
Action

The next command handler in the command execution chain.

executionContext
CommandExecutionContext

Current command execution context.

Remarks

A command handler can implement ICommandHandler<T> or IChainedCommandHandler<T>, but either way this method executes the command by either this or next command handler.

If commandHandler implements ICommandHandler<T>, its ExecuteCommand(T, CommandExecutionContext) method is called. If it returns false, nextCommandHandler is invoked.

If commandHandler implements IChainedCommandHandler<T>, its ExecuteCommand(T, Action, CommandExecutionContext) method is invoked with nextCommandHandler passed as an argument.

Applies to