Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Invoked when the user clicks this command on the menu.
Namespace: Microsoft.VisualStudio.Modeling.ExtensionEnablement
Assembly: Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)
Syntax
'Declaration
Sub Execute ( _
command As IMenuCommand _
)
void Execute(
IMenuCommand command
)
void Execute(
IMenuCommand^ command
)
abstract Execute :
command:IMenuCommand -> unit
function Execute(
command : IMenuCommand
)
Parameters
- command
Type: Microsoft.VisualStudio.Modeling.ExtensionEnablement.IMenuCommand
IMenuCommand
Remarks
Declare an imported property Context in order to access the diagram and model:
[Import]
public IDiagramContext Context { get; set; }
public void Execute (IMenuCommand command)
{
foreach (IShape<IElement> in
Context.CurrentDiagram.GetSelectedShapes<IElement>())
{...}}
If your command performs more than one change in the model, consider grouping them together in a single transaction using ILinkedUndoTransaction, so that the user can undo them with a single undo operation.
For more information, see How to: Define a Menu Command on a Modeling Diagram.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.Modeling.ExtensionEnablement Namespace