當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET AddInToken.Activate方法代碼示例

本文整理匯總了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))
開發者ID:VB.NET開發者,項目名稱:System.AddIn.Hosting,代碼行數:22,代碼來源:AddInToken.Activate

示例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)
開發者ID:VB.NET開發者,項目名稱:System.AddIn.Hosting,代碼行數:7,代碼來源:AddInToken.Activate

示例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))
開發者ID:VB.NET開發者,項目名稱:System.AddIn.Hosting,代碼行數:14,代碼來源:AddInToken.Activate

示例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)
開發者ID:VB.NET開發者,項目名稱:System.AddIn.Hosting,代碼行數:14,代碼來源:AddInToken.Activate


注:本文中的System.AddIn.Hosting.AddInToken.Activate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。