Compartilhar via


Propriedade VSProjectEvents.ReferencesEvents

Obtém um ReferencesEvents objeto fornece acesso aos eventos de References coleção.

Namespace:  VSLangProj
Assembly:  VSLangProj (em VSLangProj.dll)

Sintaxe

'Declaração
ReadOnly Property ReferencesEvents As ReferencesEvents
    Get
ReferencesEvents ReferencesEvents { get; }
property ReferencesEvents^ ReferencesEvents {
    ReferencesEvents^ get ();
}
abstract ReferencesEvents : ReferencesEvents
function get ReferencesEvents () : ReferencesEvents

Valor de propriedade

Tipo: VSLangProj.ReferencesEvents
Retorna um ReferencesEvents objeto.

Comentários

O ReferencesEvents propriedade fornece acesso a eventos de três ReferenceAdded, ReferenceChanged, e ReferenceRemoved.

Exemplos

Este exemplo conecta os métodos de manipulação de eventos para um projeto específico usando o ReferencesEvents propriedade.

' 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

Segurança do .NET Framework

Consulte também

Referência

VSProjectEvents Interface

Namespace VSLangProj