共用方式為


ICommandExtension.Execute 方法

當使用者按一下功能表上的這個命令時,便會叫用。

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

語法

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

參數

備註

若要存取 [圖表] 和 [模型來宣告匯入的屬性內容:

[Import]
public IDiagramContext Context { get; set; }
public void Execute (IMenuCommand command)
{
  foreach (IShape<IElement> in 
      Context.CurrentDiagram.GetSelectedShapes<IElement>())
  {...}}

如果您的指令執行一個以上的變更取決於模型中,請考慮將它們群組在一起在單一交易,使用ILinkedUndoTransaction,讓使用者能復原它們與單一復原操作。

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

.NET Framework 安全性

請參閱

參考

ICommandExtension 介面

Microsoft.VisualStudio.Modeling.ExtensionEnablement 命名空間