Compartilhar via


CommandHandlerExtensions.GetCommandState<T> Method

Definition

Called to determine the state of the command.

public:
generic <typename T>
 where T : Microsoft::VisualStudio::Commanding::CommandArgs[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Commanding::CommandState GetCommandState(Microsoft::VisualStudio::Commanding::ICommandHandler ^ commandHandler, T args, Func<Microsoft::VisualStudio::Commanding::CommandState> ^ nextCommandHandler);
public static Microsoft.VisualStudio.Commanding.CommandState GetCommandState<T> (this Microsoft.VisualStudio.Commanding.ICommandHandler commandHandler, T args, Func<Microsoft.VisualStudio.Commanding.CommandState> nextCommandHandler) where T : Microsoft.VisualStudio.Commanding.CommandArgs;
static member GetCommandState : Microsoft.VisualStudio.Commanding.ICommandHandler * 'T * Func<Microsoft.VisualStudio.Commanding.CommandState> -> Microsoft.VisualStudio.Commanding.CommandState (requires 'T :> Microsoft.VisualStudio.Commanding.CommandArgs)
<Extension()>
Public Function GetCommandState(Of T As CommandArgs) (commandHandler As ICommandHandler, args As T, nextCommandHandler As Func(Of CommandState)) As CommandState

Type Parameters

T

Parameters

commandHandler
ICommandHandler

A command handler to query the state of the command.

args
T

The CommandArgs arguments for the command.

nextCommandHandler
Func<CommandState>

The next command handler in the command execution chain.

Returns

A CommandState instance that contains information on the availability of the command.

Remarks

A command handler can implement ICommandHandler<T> or IChainedCommandHandler<T>, but either way this method returns the final state of the command as returned by either this or next command handler.

If commandHandler implements ICommandHandler<T>, its GetCommandState(T) method is called. If it returns Unspecified, nextCommandHandler is invoked.

If commandHandler implements IChainedCommandHandler<T>, its GetCommandState(T, Func<CommandState>) method is invoked with nextCommandHandler passed as an argument.

Applies to