Export (0) Print
Expand All

MenuCommandService Class

Implements the IMenuCommandService interface.

System.Object
  System.ComponentModel.Design.MenuCommandService

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

public class MenuCommandService : IMenuCommandService, 
	IDisposable

The MenuCommandService type exposes the following members.

  NameDescription
Public methodMenuCommandServiceInitializes a new instance of the MenuCommandService class.
Top

  NameDescription
Public propertyVerbsGets a collection of the designer verbs that are currently available.
Top

  NameDescription
Public methodAddCommandAdds a command handler to the menu command service.
Public methodAddVerbAdds a verb to the verb table of the MenuCommandService.
Public methodDispose()Releases all resources used by the MenuCommandService.
Protected methodDispose(Boolean)Releases all resources used by the MenuCommandService.
Protected methodEnsureVerbsEnsures that the verb list has been created.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindCommand(CommandID)Searches for the MenuCommand associated with the given command ID.
Protected methodFindCommand(Guid, Int32)Searches for the MenuCommand associated with the given command.
Protected methodGetCommandListGets the command list for a given GUID.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetServiceGets a reference to the requested service.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGlobalInvoke(CommandID)Invokes the given command on the local form or in the global environment.
Public methodGlobalInvoke(CommandID, Object)Invokes the given command with the given parameter on the local form or in the global environment.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnCommandsChangedRaises the MenuCommandsChanged event.
Public methodRemoveCommandRemoves the given menu command from the document.
Public methodRemoveVerbRemoves the given verb from the document.
Public methodShowContextMenuShows the shortcut menu with the given command ID at the given location.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventMenuCommandsChangedOccurs when the status of a menu command has changed.
Top

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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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