共用方式為


ICommandHandler Interface

Definition

This interface marks a class that implements at least one strongly-typed ICommandHandler<T> or IChainedCommandHandler<T>.

public interface class ICommandHandler
public interface ICommandHandler
type ICommandHandler = interface
Public Interface ICommandHandler
Derived

Examples

[Export(typeof(ICommandHandler))]
[Name(nameof(MyCommandHandler))]
[ContentType("text")]
[Order(Before ="OtherCommandHandler")]   
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class MyCommandHandler : ICommandHandler<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.

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