AddInController 類別

定義

提供對增益集的存取,可執行各種工作。

public ref class AddInController sealed
public sealed class AddInController
type AddInController = class
Public NotInheritable Class AddInController
繼承
AddInController

範例

下列範例會使用 AddInController 物件,在與先前啟動的載入宏相同的環境中啟動載入宏。

// Get the AddInController of a
// currently actived add-in (CalcAddIn).
AddInController aiController = AddInController.GetAddInController(CalcAddIn);

// Select another token.
AddInToken selectedToken2 = ChooseAddIn(tokens);

// Activate a second add-in, CalcAddIn2, in the same
// appliation domain and process as the first add-in by passing
// the first add-in's AddInEnvironment object to the Activate method.
AddInEnvironment aiEnvironment = aiController.AddInEnvironment;
Calculator CalcAddIn2 =
    selectedToken2.Activate<Calculator>(aiEnvironment);

// Get the AddInController for the second add-in to compare environments.
AddInController aiController2 = AddInController.GetAddInController(CalcAddIn2);
Console.WriteLine("Add-ins in same application domain: {0}", aiController.AppDomain.Equals(aiController2.AppDomain));
Console.WriteLine("Add-ins in same process: {0}", aiEnvironment.Process.Equals(aiController2.AddInEnvironment.Process));
' Get the AddInController of a 
' currently activated add-in (CalcAddIn).
Dim aiController As AddInController = AddInController.GetAddInController(CalcAddIn)

' Select another token.
Dim selectedToken2 As AddInToken = ChooseAddIn(tokens)

' Activate a second add-in, CalcAddIn2, in the same
' appliation domain and process as the first add-in by passing
' the first add-in's AddInEnvironment object to the Activate method.

Dim aiEnvironment As AddInEnvironment = aiController.AddInEnvironment
Dim CalcAddIn2 As Calculator = _
    selectedToken2.Activate(Of Calculator)(aiEnvironment)

' Get the AddInController for the second add-in to compare environments.
Dim aiController2 As AddInController = AddInController.GetAddInController(CalcAddIn2)

Console.WriteLine("Add-ins in same application domain: {0}", _
    aiController.AppDomain.Equals(aiController2.AppDomain))
Console.WriteLine("Add-ins in same process: {0}", _
    aiEnvironment.Process.Equals(aiController2.AddInEnvironment.Process))

備註

使用此類別來執行下列工作:

  • AddInEnvironment使用屬性來取得AddInEnvironment載入宏的物件。 然後使用該物件,在與原始載入宏相同的應用程式域中啟用其他載入宏並處理。

  • AppDomain使用屬性來取得AppDomain載入宏的物件。 然後使用該物件,在與原始載入宏相同的應用程式域中啟用其他載入宏。 請注意,由於跨進程遠端處理的限制,此案例不適用於個別進程中啟用的載入宏。

  • Token使用屬性取得AddInToken代表載入宏的物件。

  • 使用 Shutdown 方法關閉載入宏。

若要取得載入宏的控制器,請呼叫 GetAddInController 方法,並傳遞載入宏的實例作為其參數。

屬性

AddInEnvironment

取得 AddInEnvironment 物件。

AppDomain

取得包含增益集的應用程式定義域。

Token

取得表示增益集的語彙基元 (Token)。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetAddInController(Object)

取得增益集的控制器。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Shutdown()

停用增益集。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於