ICommandExtension.QueryStatus, méthode

Implémentez cette opération pour définir si votre commande doit être visible et active.Commande set. Visible et commande. Actif.Ne modifiez pas l'état du modèle.

Espace de noms :  Microsoft.VisualStudio.Modeling.ExtensionEnablement
Assembly :  Microsoft.VisualStudio.Modeling.Sdk.11.0 (dans Microsoft.VisualStudio.Modeling.Sdk.11.0.dll)

Syntaxe

'Déclaration
Sub QueryStatus ( _
    command As IMenuCommand _
)
void QueryStatus(
    IMenuCommand command
)

Paramètres

Notes

Déclarez un contexte importé de propriété pour accéder au diagramme et au modèle :

[Import]
public IDiagramContext Context { get; set; }
public void Execute (IMenuCommand command)
{
  command.Enabled = command.Visible =
      Context.CurrentDiagram
          .GetSelectedShapes<IClassifier>().Count() > 2;
}

Pour plus d'informations, consultez Comment : définir une commande de menu sur un diagramme de modélisation.

Sécurité .NET Framework

Voir aussi

Référence

ICommandExtension Interface

Microsoft.VisualStudio.Modeling.ExtensionEnablement, espace de noms