Partilhar via


VSProjectEvents.ImportsEvents (Propriedade)

Obtém um ImportsEvents objeto que fornece acesso aos Imports Eventos de objeto.

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

Sintaxe

'Declaração
ReadOnly Property ImportsEvents As ImportsEvents
'Uso
Dim instance As VSProjectEvents
Dim value As ImportsEvents

value = instance.ImportsEvents
ImportsEvents ImportsEvents { get; }
property ImportsEvents^ ImportsEvents {
    ImportsEvents^ get ();
}
/** @property */
ImportsEvents get_ImportsEvents ()
function get ImportsEvents () : ImportsEvents

Valor de propriedade

Retorna um ImportsEvents objeto.

Comentários

O ImportsEvents objeto fornece acesso a dois eventos, ImportAdded e ImportRemoved.

Exemplo

Este exemplo conecta métodos tratamento de eventos-ao projeto e ImportAddedImportRemoved para um específico usando o Events objeto.

' 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

Consulte também

Referência

VSProjectEvents (Interface)
VSProjectEvents (Membros)
VSLangProj (Namespace)