Partager via


VSProjectEvents.ReferencesEvents, propriété

Mise à jour : novembre 2007

Obtient un objet ReferencesEvents qui fournit l'accès aux événements de la collection References.

Espace de noms :  VSLangProj
Assembly :  VSLangProj (dans VSLangProj.dll)

Syntaxe

ReadOnly Property ReferencesEvents As ReferencesEvents

Dim instance As VSProjectEvents
Dim value As ReferencesEvents

value = instance.ReferencesEvents
ReferencesEvents ReferencesEvents { get; }
property ReferencesEvents^ ReferencesEvents {
    ReferencesEvents^ get ();
}
function get ReferencesEvents () : ReferencesEvents

Valeur de propriété

Type : VSLangProj.ReferencesEvents

Retourne un objet ReferencesEvents.

Notes

La propriété ReferencesEvents fournit l'accès à trois événements, ReferenceAdded, ReferenceChanged et ReferenceRemoved.

Exemples

Cet exemple connecte des méthodes de gestion d'événements d'un projet spécifique à l'aide de la propriété 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

Autorisations

Voir aussi

Référence

VSProjectEvents, interface

Membres VSProjectEvents

VSLangProj, espace de noms