次の方法で共有


AddInController.AddInEnvironment プロパティ

定義

AddInEnvironment オブジェクトを取得します。

public:
 property System::AddIn::Hosting::AddInEnvironment ^ AddInEnvironment { System::AddIn::Hosting::AddInEnvironment ^ get(); };
public System.AddIn.Hosting.AddInEnvironment AddInEnvironment { get; }
member this.AddInEnvironment : System.AddIn.Hosting.AddInEnvironment
Public ReadOnly Property AddInEnvironment As AddInEnvironment

プロパティ値

元のアドインと同じ環境で他のアドインをアクティブにするために使用できるオブジェクト。

次の例では、最初のアドインと同じ環境内で 2 番目のアドインをアクティブにします。

// 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 このプロパティを使用します。 次に、そのオブジェクトを使用して、元のアドインと同じアプリケーション ドメインとプロセス内の他のアドインをアクティブ化します。

適用対象