VSLangProjWebReferencesEvents 介面
可用來存取因加入、刪除或變更專案 Web 參考而引發的事件。
命名空間: VSLangProj80
組件: VSLangProj80 (在 VSLangProj80.dll 中)
語法
'宣告
<GuidAttribute("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")> _
Public Interface VSLangProjWebReferencesEvents _
Inherits _VSLangProjWebReferencesEvents, _dispVSLangProjWebReferencesEvents_Event
[GuidAttribute("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
public interface VSLangProjWebReferencesEvents : _VSLangProjWebReferencesEvents,
_dispVSLangProjWebReferencesEvents_Event
[GuidAttribute(L"33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
public interface class VSLangProjWebReferencesEvents : _VSLangProjWebReferencesEvents,
_dispVSLangProjWebReferencesEvents_Event
[<GuidAttribute("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")>]
type VSLangProjWebReferencesEvents =
interface
interface _VSLangProjWebReferencesEvents
interface _dispVSLangProjWebReferencesEvents_Event
end
public interface VSLangProjWebReferencesEvents extends _VSLangProjWebReferencesEvents, _dispVSLangProjWebReferencesEvents_Event
VSLangProjWebReferencesEvents 型別會公開下列成員。
方法
回頁首
事件
名稱 | 說明 | |
---|---|---|
OnAfterWebReferenceAdded | 如需功能資訊,請參閱 OnAfterWebReferenceAdded。 (繼承自 _dispVSLangProjWebReferencesEvents_Event)。 | |
OnBeforeWebReferenceRemoved | 如需功能資訊,請參閱 OnBeforeWebReferenceRemoved。 (繼承自 _dispVSLangProjWebReferencesEvents_Event)。 | |
OnWebReferenceChanged | 如需功能資訊,請參閱 OnWebReferenceChanged。 (繼承自 _dispVSLangProjWebReferencesEvents_Event)。 |
回頁首
備註
VSLangProjWebReferencesEvents 物件可以透過 VSProjectEvents2 物件或 DTE 物件存取。
這個物件具有下列事件:
範例
這個範例會使用 VSLangProjWebReferencesEvents 屬性,連接特定專案的事件處理方法。 如需如何執行巨集範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。
先開啟 Visual Basic、Visual C# 或 Visual J# 專案,再執行這個巨集。
' Macro code.
' Connects trivial methods to the OnAfterWebReferenceAdded,
' OnBeforeWebReferenceRemoved and OnWebReferenceChanged
' events of the first project in the solution.
' The first project is a Visual Basic, C#, or J# rpoject.
Imports VSLangProj
Imports VSLangProj80
Sub ConnectWebEvents()
Dim proj As Project = DTE.Solution.Projects.Item(1)
Dim vsproj As VSProject2 = CType(proj.Object, VSProject2)
Dim refEvents As VSLangProjWebReferencesEvents =_
vsproj.Events2.VSLangProjWebReferencesEvents
AddHandler refEvents.OnAfterWebReferenceAdded,_
AddressOf WebReferenceAdded
AddHandler refEvents.OnBeforeWebReferenceRemoved,_
AddressOf WebReferenceRemoved
AddHandler refEvents.OnWebReferenceChanged,_
AddressOf WebReferenceChanged
End Sub
Sub WebReferenceRemoved(ByVal removedRef As Object)
MsgBox("The reference for " & removedRef.Name & " was removed.")
End Sub
Sub WebReferenceChanged(ByVal changedRef As Object)
MsgBox("The reference for " & changedRef.Name & " was changed.")
End Sub
Sub WebReferenceAdded(ByVal addedRef As Object)
MsgBox("The reference for " & addedRef.Name & " was added.")
End Sub