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 类型公开以下成员。
方法
页首
事件
页首
备注
可以从 VSProjectEvents2 对象或 DTE 对象访问 VSLangProjWebReferencesEvents 对象。
此对象具有以下事件:
示例
此示例通过使用 VSLangProjWebReferencesEvents 属性为特定项目连接事件处理方法。 有关如何运行宏示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例。
在运行此宏之前,请打开一个 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