VSProjectEvents.ImportsEvents プロパティ
更新 : 2007 年 11 月
Imports オブジェクトのイベントにアクセスできるようにする ImportsEvents オブジェクトを取得します。
名前空間 : VSLangProj
アセンブリ : VSLangProj (VSLangProj.dll 内)
構文
'宣言
ReadOnly Property ImportsEvents As ImportsEvents
'使用
Dim instance As VSProjectEvents
Dim value As ImportsEvents
value = instance.ImportsEvents
ImportsEvents ImportsEvents { get; }
property ImportsEvents^ ImportsEvents {
ImportsEvents^ get ();
}
function get ImportsEvents () : ImportsEvents
プロパティ値
ImportsEvents オブジェクトを返します。
解説
ImportsEvents オブジェクトを使用すると、ImportAdded と ImportRemoved の 2 つのイベントにアクセスできます。
例
Events オブジェクトを使用して、特定のプロジェクトの ImportAdded および ImportRemoved に、イベント処理メソッドを関連付ける例を次に示します。
' Macro editor
' This example adds event handlers to the two events in
' ImportsEvents.
Imports VSLangProj
Sub ImportAdded(ByVal addedImport As String)
MsgBox("The import '" & addedImport & "' was added.")
End Sub
Sub ImportRemoved(ByVal removedImport As String)
MsgBox("The import '" & removedImport & "' was removed.")
End Sub
Sub ConnectImportsEvents()
Dim proj As Project = DTE.Solution.Projects.Item(1)
Dim vsproj As VSProject = CType(proj.Object, VSProject)
Dim impEvents As ImportsEvents = vsproj.Events.ImportsEvents
AddHandler impEvents.ImportAdded, AddressOf ImportAdded
AddHandler impEvents.ImportRemoved, AddressOf ImportRemoved
End Sub
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。