本文整理汇总了VB.NET中System.AddIn.Hosting.AddInToken.Activate方法的典型用法代码示例。如果您正苦于以下问题:VB.NET AddInToken.Activate方法的具体用法?VB.NET AddInToken.Activate怎么用?VB.NET AddInToken.Activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.AddIn.Hosting.AddInToken
的用法示例。
在下文中一共展示了AddInToken.Activate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ChooseAddIn
' 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))
示例2: ChooseAddIn
'Ask the user which add-in they would like to use.
Dim selectedToken As AddInToken = ChooseAddIn(tokens)
'Activate the selected AddInToken in a new
'application domain with the Internet trust level.
Dim CalcAddIn As Calculator = selectedToken.Activate(Of Calculator)(AddInSecurityLevel.Internet)
'Run the add-in using a custom method.
RunCalculator(CalcAddIn)
示例3:
' Get the application domain
' of an existing add-in (CalcAddIn).
Dim aiCtrl As AddInController = AddInController.GetAddInController(CalcAddIn)
Dim AddInAppDom As AppDomain = aiCtrl.AppDomain
' Activate another add-in in the same appliation domain.
Dim CalcAddIn3 As Calculator = selectedToken2.Activate(Of Calculator)(AddInAppDom)
' Show that the CalcAddIn3 was loaded
' into CalcCaddIn's application domain.
Dim aic As AddInController = AddInController.GetAddInController(CalcAddIn3)
Console.WriteLine("Add-in loaded into existing application domain: {0}", _
aic.AppDomain.Equals(AddInAppDom))
示例4: AddInProcess
' Create an external process.
Dim pExternal As New AddInProcess()
' Activate an add-in in the external process
' with a full trust security level.
Dim CalcAddIn4 As Calculator = _
selectedToken.Activate(Of Calculator)(pExternal, _
AddInSecurityLevel.FullTrust)
' Show that the add-in is an external process
' by verifying that it is not in the current (host's) process.
Dim AddinCtl As AddInController = AddInController.GetAddInController(CalcAddIn4)
Console.WriteLine("Add-in in host's process: {0}", _
AddinCtl.AddInEnvironment.Process.IsCurrentProcess)