AddInController Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides access to an add-in for a variety of tasks.
public ref class AddInController sealed
public sealed class AddInController
type AddInController = class
Public NotInheritable Class AddInController
- Inheritance
-
AddInController
The following example activates an add-in within the same environment as a previously activated add-in by using an AddInController object.
// 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))
Use this class to perform the following tasks:
Use the AddInEnvironment property to obtain an AddInEnvironment object for an add-in. Then use that object to activate other add-ins in the same application domain and process as the original add-in.
Use the AppDomain property to obtain an AppDomain object for an add-in. Then use that object to activate other add-ins in the same application domain as the original add-in. Note that because of limitations in cross-process remoting, this scenario will not work with add-ins that are activated in a separate process.
Use the Token property to obtain an AddInToken object that represents an add-in.
Shut down an add-in with the Shutdown method.
To obtain the controller for an add-in, call the GetAddInController method and pass an instance of the add-in as its parameter.
Add |
Gets an AddInEnvironment object. |
App |
Gets the application domain that contains an add-in. |
Token |
Gets the token that represents the add-in. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Obtains the controller for an add-in. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
Shutdown() |
Disables an add-in. |
To |
Returns a string that represents the current object. (Inherited from Object) |
Product | Versies |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET-feedback
.NET is een open source project. Selecteer een koppeling om feedback te geven: