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
)
參數
- command
型別:Microsoft.VisualStudio.Modeling.ExtensionEnablement.IMenuCommand
IMenuCommand
備註
若要存取 [圖表] 和 [模型來宣告匯入的屬性內容:
[Import]
public IDiagramContext Context { get; set; }
public void Execute (IMenuCommand command)
{
foreach (IShape<IElement> in
Context.CurrentDiagram.GetSelectedShapes<IElement>())
{...}}
如果您的指令執行一個以上的變更取決於模型中,請考慮將它們群組在一起在單一交易,使用ILinkedUndoTransaction,讓使用者能復原它們與單一復原操作。
如需詳細資訊,請參閱 HOW TO:在模型圖表上定義功能表命令。
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。