VSProjectEvents2.ImportsEvents Özellik
Alır bir ImportsEvents erişim sağlayan nesne Imports nesne olayları.
Ad alanı: VSLangProj80
Derleme: VSLangProj80 (VSLangProj80.dll içinde)
Sözdizimi
'Bildirim
ReadOnly Property ImportsEvents As ImportsEvents
ImportsEvents ImportsEvents { get; }
property ImportsEvents^ ImportsEvents {
ImportsEvents^ get ();
}
abstract ImportsEvents : ImportsEvents with get
function get ImportsEvents () : ImportsEvents
Özellik Değeri
Tür: ImportsEvents
Bir ImportsEvents nesnesi.
Notlar
ImportsEvents Nesne iki olay erişim sağlar ImportAdded ve ImportRemoved.
Örnekler
Bu örnek olay işleme yöntemlerini bağlayan ImportAdded ve ImportRemoved olayları kullanarak belirli bir proje için Events nesne.Makro örneklerini çalıştırma hakkında daha fazla bilgi için bkz: Nasıl yapılır: Otomasyon Nesne Modeli Kod Örnekleri Derleme ve Çalıştırma.
Açık bir Visual Basic veya Visual C# Bu makroyu çalıştırmadan önce proje.
' Macro editor
' This example adds event handlers to the two events in
' ImportsEvents.
Imports VSLangProj
Imports VSLangProj80
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 VSProject2 = CType(proj.Object, VSProject2)
Dim impEvents As ImportsEvents = vsproj.Events.ImportsEvents
AddHandler impEvents.ImportAdded, AddressOf ImportAdded
AddHandler impEvents.ImportRemoved, AddressOf ImportRemoved
End Sub
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.