共用方式為


ICommandExtension.QueryStatus 方法

實作此選項以定義您的命令是否應該可見且處於啟用狀態。 設定 command.Visible 和 command.Enabled。 不要變更模型的狀態。

命名空間:  Microsoft.VisualStudio.Modeling.ExtensionEnablement
組件:  Microsoft.VisualStudio.Modeling.Sdk.12.0 (在 Microsoft.VisualStudio.Modeling.Sdk.12.0.dll 中)

語法

'宣告
Sub QueryStatus ( _
    command As IMenuCommand _
)
void QueryStatus(
    IMenuCommand command
)

參數

備註

宣告匯入的屬性內容就可存取這個圖表和模型:

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

如需詳細資訊,請參閱如何:在模型圖表上定義功能表命令

.NET Framework 安全性

請參閱

參考

ICommandExtension 介面

Microsoft.VisualStudio.Modeling.ExtensionEnablement 命名空間