Propriedade VSProjectEvents.ImportsEvents

Obtém um ImportsEvents objeto fornece acesso para o Imports eventos de objeto.

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

Sintaxe

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

Valor de propriedade

Tipo: VSLangProj.ImportsEvents
Retorna um ImportsEvents objeto.

Comentários

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

Exemplos

Este exemplo conecta os métodos de manipulação de eventos para o ImportAdded e ImportRemoved para um projeto 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

Segurança do .NET Framework

Consulte também

Referência

VSProjectEvents Interface

Namespace VSLangProj