MenuCommandService Class

 

Implements the IMenuCommandService interface.

Namespace:   System.ComponentModel.Design
Assembly:  System.Design (in System.Design.dll)

System::Object
  System.ComponentModel.Design::MenuCommandService

public ref class MenuCommandService : IMenuCommandService, IDisposable

NameDescription
System_CAPS_pubmethodMenuCommandService(IServiceProvider^)

Initializes a new instance of the MenuCommandService class.

NameDescription
System_CAPS_pubpropertyVerbs

Gets a collection of the designer verbs that are currently available.

NameDescription
System_CAPS_pubmethodAddCommand(MenuCommand^)

Adds a command handler to the menu command service.

System_CAPS_pubmethodAddVerb(DesignerVerb^)

Adds a verb to the verb table of the MenuCommandService.

System_CAPS_pubmethodDispose()

Releases all resources used by the MenuCommandService.

System_CAPS_protmethodDispose(Boolean)

Releases all resources used by the MenuCommandService.

System_CAPS_protmethodEnsureVerbs()

Ensures that the verb list has been created.

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFindCommand(CommandID^)

Searches for the MenuCommand associated with the given command ID.

System_CAPS_protmethodFindCommand(Guid, Int32)

Searches for the MenuCommand associated with the given command.

System_CAPS_protmethodGetCommandList(Guid)

Gets the command list for a given GUID.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_protmethodGetService(Type^)

Gets a reference to the requested service.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodGlobalInvoke(CommandID^)

Invokes the given command on the local form or in the global environment.

System_CAPS_pubmethodGlobalInvoke(CommandID^, Object^)

Invokes the given command with the given parameter on the local form or in the global environment.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnCommandsChanged(MenuCommandsChangedEventArgs^)

Raises the MenuCommandsChanged event.

System_CAPS_pubmethodRemoveCommand(MenuCommand^)

Removes the given menu command from the document.

System_CAPS_pubmethodRemoveVerb(DesignerVerb^)

Removes the given verb from the document.

System_CAPS_pubmethodShowContextMenu(CommandID^, Int32, Int32)

Shows the shortcut menu with the given command ID at the given location.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubeventMenuCommandsChanged

Occurs when the status of a menu command has changed.

The MenuCommandService class implements the IMenuCommandService interface, which is the managed interface used to add handlers for menu commands and to define verbs.

The MenuCommandService class is automatically offered by the package class to offer global commands for an entire package, and it is also offered by the Microsoft.VisualStudio.Shell.WindowPane class to offer commands for the current window. This offering is always done through the service container, so anyone deriving from the package or window pane classes can remove or replace the default implementation of the IMenuCommandService interface.

The MenuCommandService class utilizes several other services. All of these services are optional, so the behavior of the MenuCommandService class degrades if one or more services are missing. The following table shows which services are used and for what purpose.

Service

Purpose

ISelectionService

Used to discover the current selection in order to obtain verbs offered by the currently selected designer.

IDesignerHost

Used to obtain the designer for the currently selected component, if any.

Microsoft.VisualStudio.Shell.Interop.IVsUIShell

Used to notify Visual Studio that the command status has changed.

Microsoft.VisualStudio.Shell.Interop.IOleComponentUIManager

Used to show context menus.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: