VSProjectEvents.ReferencesEvents プロパティ
References コレクションのイベントにアクセスできるようにする ReferencesEvents オブジェクトを取得します。
名前空間: VSLangProj
アセンブリ: VSLangProj (vslangproj.dll 内)
構文
'宣言
ReadOnly Property ReferencesEvents As ReferencesEvents
'使用
Dim instance As VSProjectEvents
Dim value As ReferencesEvents
value = instance.ReferencesEvents
ReferencesEvents ReferencesEvents { get; }
property ReferencesEvents^ ReferencesEvents {
ReferencesEvents^ get ();
}
/** @property */
ReferencesEvents get_ReferencesEvents ()
function get ReferencesEvents () : ReferencesEvents
プロパティ値
ReferencesEvents オブジェクトを返します。
解説
ReferencesEvents プロパティを使用すると、ReferenceAdded、ReferenceChanged、ReferenceRemoved の 3 つのイベントにアクセスできます。
使用例
ReferencesEvents プロパティを使用して、特定のプロジェクトのイベント処理メソッドを関連付ける例を次に示します。
' Macro Editor
' Connects trivial methods to the ReferenceAdded and ReferenceDeleted
' events of the first project in the solution.
Imports VSLangProj
Sub ConnectEvents()
Dim proj As Project = DTE.Solution.Projects.Item(1)
Dim vsproj As VSProject = CType(proj.Object, VSProject)
Dim refEvents As ReferencesEvents = vsproj.Events.ReferencesEvents
AddHandler refEvents.ReferenceAdded, AddressOf ReferenceAdded
AddHandler refEvents.ReferenceRemoved, AddressOf ReferenceRemoved
AddHandler refEvents.ReferenceChanged, AddressOf ReferenceChanged
End Sub
Sub ReferenceRemoved(ByVal removedRef As Reference)
MsgBox("The reference for " & removedRef.Name & " was removed.")
End Sub
Sub ReferenceChanged(ByVal removedRef As Reference)
MsgBox("The reference for " & removedRef.Name & " was changed.")
End Sub
Sub ReferenceAdded(ByVal addedRef As Reference)
MsgBox("The reference for " & addedRef.Name & " was added.")
End Sub
参照
関連項目
VSProjectEvents インターフェイス
VSProjectEvents メンバ
VSLangProj 名前空間