Share via


CommandSet Class

Definition

Provides functionality for extending Visual Studio through brokered services.

public sealed class CommandSet : Microsoft.VisualStudio.Extensibility.ExtensionPart, IDisposable, Microsoft.VisualStudio.Extensibility.Commands.ICommandSet
type CommandSet = class
    inherit ExtensionPart
    interface ICommandSet
    interface IDisposable
Public NotInheritable Class CommandSet
Inherits ExtensionPart
Implements ICommandSet, IDisposable
Inheritance
CommandSet
Implements

Constructors

CommandSet(VisualStudioExtensibility, Extension, IServiceProvider, ICommandSetFactory)

Initializes a new instance of the CommandSet class.

Properties

Container

Gets the container instance that hosts this and related parts.

(Inherited from ExtensionPart)
Extensibility

Gets the extensibility instance for this service.

(Inherited from ExtensionPart)
IsDisposed

Gets a value indicating whether the object is disposed.

(Inherited from ExtensionPart)
Item[String]

Gets a registered command instance on this command set.

Methods

Dispose() (Inherited from ExtensionPart)
Dispose(Boolean)

Disposes the instane and underlying services.

(Inherited from ExtensionPart)
GetDynamicCommandAnchor<T>()

Gets a registered command instance on this command set.

InitializeAsync(CancellationToken)

Provides an asynchronous way for extension parts to initialize their fields. This method is called before the instance is handed to Visual Studio.

(Inherited from ExtensionPart)
InitializeAsync(IServiceBroker, Update, CancellationToken)

Allows the command set to initialize asynchronously.

RegisterAnchoredCommand(IDynamicCommand, String)

Register an existing command implementation that is to be parented to a dynamic command anchor.

RegisterCommand(ICommand)

Register an existing command implementation. This is only for commands that are also registered in extension.json.

RegisterCommandAsync(Type)

Registers a command defined by the provided type. This is only for commands that are also registered in extension.json.

RegisterCommandAsync<T>()

Registers a command from a given type. This is only for commands that are also registered in extension.json.

RegisterDynamicCommandAnchorAsync(Type)

Registers a command anchor defined by the provided type. This is only for command anchors that are also registered in extension.json.

UnregisterDynamicCommand(String)

Unregister a command.

Events

CommandAdded

Event to be triggered when a new command is added to the command set.

CommandRemoved

Event to be triggered when a command is removed from the command set.

Explicit Interface Implementations

ICommandSet.Commands

Gets the list of commands for this command set. Each command must have a unique Id within this collection.

Applies to