using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.Commanding { /// /// This interface marks a class that implements at least one strongly-typed /// or . /// /// /// This is a MEF component part and should be exported as the non-generic with required /// [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes. /// /// /// [Export(typeof(ICommandHandler))] /// [Name(nameof(MyCommandHandler))] /// [ContentType("text")] /// [Order(Before ="OtherCommandHandler")] /// [TextViewRole(PredefinedTextViewRoles.Editable)] /// internal class MyCommandHandler : ICommandHandler /// public interface ICommandHandler { } /// /// Represents a handler for a command associated with specific . /// /// /// This is a MEF component part and should be exported as the non-generic with required /// [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes. /// /// /// [Export(typeof(ICommandHandler))] /// [Name(nameof(MyCommandHandler))] /// [ContentType("text")] /// [Order(Before ="OtherCommandHandler")] /// [TextViewRole(PredefinedTextViewRoles.Editable)] /// internal class MyCommandHandler : ICommandHandler /// public interface ICommandHandler : ICommandHandler, INamed where T : CommandArgs { /// /// Called to determine the state of the command. /// /// The arguments for the command. /// A instance that contains information on the availability of the command. CommandState GetCommandState(T args); /// /// Called to execute the command. /// /// The arguments for the command. /// Returns true if the command was handled, false otherwise. bool ExecuteCommand(T args, CommandExecutionContext executionContext); } /// /// A command handler that can opt out of . /// internal interface IDynamicCommandHandler where T : CommandArgs { /// /// Determines whether should be called. /// bool CanExecuteCommand(T args); } }