OleMenuCommandService Class
This class derives from the MenuCommandService class and implements IOleCommandTarget. MenuCommandService is the managed class used to add handlers for menu commands and to define verbs.
This API is not CLS-compliant.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'宣告
<ComVisibleAttribute(True)> _
<CLSCompliantAttribute(False)> _
Public Class OleMenuCommandService _
Inherits MenuCommandService _
Implements IOleCommandTarget
'用途
Dim instance As OleMenuCommandService
[ComVisibleAttribute(true)]
[CLSCompliantAttribute(false)]
public class OleMenuCommandService : MenuCommandService,
IOleCommandTarget
[ComVisibleAttribute(true)]
[CLSCompliantAttribute(false)]
public ref class OleMenuCommandService : public MenuCommandService,
IOleCommandTarget
[<ComVisibleAttribute(true)>]
[<CLSCompliantAttribute(false)>]
type OleMenuCommandService =
class
inherit MenuCommandService
interface IOleCommandTarget
end
public class OleMenuCommandService extends MenuCommandService implements IOleCommandTarget
Remarks
OleMenuCommandService is automatically offered by the Package class (to offer global commands for an entire package), and it is also offered by the WindowPane class (to offer commands for the current window). This offering is always done via the service container, so anyone deriving from the Package or WindowPane classes can remove or replace the default implementation of OleMenuCommandService. OleMenuCommandService utilizes several other services. All of these services are optional, so the behavior of OleMenuCommandService will degrade if one or more services are missing. The following table shows which services are used and for what purpose:
Service |
Use |
---|---|
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. |
IVsUIShell |
Used to notify Visual Studio that the command status has changed. Used to execute global commands |
OleComponentUIManager |
Used to show context menus |
Inheritance Hierarchy
System.Object
System.ComponentModel.Design.MenuCommandService
Microsoft.VisualStudio.Shell.OleMenuCommandService
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.