2010-08-14 20 views

回答

1

您發現文檔中有空白。它現在更新。

要在本地條件下使用擴展點,必須創建擴展上下文,設置條件,然後查詢擴展點。例如:

// Create an extension context to be used to query the extension point using 
// a specific set of conditions. 
ExtensionContext ctx = AddinManager.CreateExtensionContext(); 

// Create and register the extension point condition 
OpenFileLocalCondition condition = new OpenFileLocalCondition (someFileName); 
ctx.RegisterCondition (condition); 

// Query the extension point 
foreach (ExtensionNode node in ctx.GetExtensionNodes ("/TextEditor/ContextMenu")) 
    (...) 

您在上下文中註冊的條件僅適用於該上下文,因此您可以有多個具有不同條件集的上下文。