ICommandExtension.QueryStatus Method
Implement this to define whether your command should be visible and enabled. Set command.Visible and command.Enabled. Do not change the state of the model.
Namespace: Microsoft.VisualStudio.Modeling.ExtensionEnablement
Assembly: Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)
Syntax
'Dichiarazione
Sub QueryStatus ( _
command As IMenuCommand _
)
void QueryStatus(
IMenuCommand command
)
void QueryStatus(
IMenuCommand^ command
)
abstract QueryStatus :
command:IMenuCommand -> unit
function QueryStatus(
command : IMenuCommand
)
Parameters
- command
Type: Microsoft.VisualStudio.Modeling.ExtensionEnablement.IMenuCommand
Set command.Visible = true if the command should appear on the menu. Set command.Enabled = true if the user can invoke the command.Set command.Text to vary the menu label.
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)
{
command.Enabled = command.Visible =
Context.CurrentDiagram
.GetSelectedShapes<IClassifier>().Count() > 2;
}
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