Share via


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

アドインを表すトークンを取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetAddInController(Object)

アドインのコントローラーを取得します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Shutdown()

アドインを無効にします。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象