Udostępnij za pośrednictwem


IChainedCommandHandler<T> Interface

Definition

Represents a command handler that depends on behavior of following command handlers in the command execution chain formed from same strongly-typed ICommandHandlers ordered according to their [Order] attributes.

generic <typename T>
 where T : CommandArgspublic interface class IChainedCommandHandler : Microsoft::VisualStudio::Commanding::ICommandHandler, Microsoft::VisualStudio::Utilities::INamed
public interface IChainedCommandHandler<T> : Microsoft.VisualStudio.Commanding.ICommandHandler, Microsoft.VisualStudio.Utilities.INamed where T : CommandArgs
type IChainedCommandHandler<'T (requires 'T :> CommandArgs)> = interface
    interface ICommandHandler
    interface INamed
Public Interface IChainedCommandHandler(Of T)
Implements ICommandHandler, INamed

Type Parameters

T
Implements

Examples

[Export(typeof(ICommandHandler))]
[Name(nameof(MyCommandHandler))]
[ContentType("text")]
[Order(Before ="OtherCommandHandler")]   
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class MyCommandHandler : IChainedCommandHandler<MyCommandArgs>

Remarks

This is a MEF component part and should be exported as the non-generic ICommandHandler with required [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes.

Properties

DisplayName

Gets display name of an instance used to represent it to the user, for example when blaming it for delays.

(Inherited from INamed)

Methods

ExecuteCommand(T, Action, CommandExecutionContext)

Called to execute the command. If this implementation does not execute the command, nextCommandHandler should be called so that other ICommandHandlers may act on this command.

GetCommandState(T, Func<CommandState>)

Called to determine the state of the command. This method should never return Unspecified as it would prevent calling following command handlers. nextCommandHandler should be called instead. If a IChainedCommandHandler<T> handles a command it doesn't own, its GetCommandState(T, Func<CommandState>) should always call nextCommandHandler" to give a chance a ICommandHandler that owns the command to enable or disable it.

Extension Methods

ExecuteCommand<T>(ICommandHandler, T, Action, CommandExecutionContext)

Called to execute the command.

GetCommandState<T>(ICommandHandler, T, Func<CommandState>)

Called to determine the state of the command.

Applies to