VSWebSite.VSWebSiteEvents Property

 

Gets the VSWebSiteEvents object for the Web site, which can be used to add event handlers.

Namespace:   VsWebSite
Assembly:  VsWebSite.Interop (in VsWebSite.Interop.dll)

Syntax

VSWebSiteEvents VSWebSiteEvents { get; }
property VSWebSiteEvents^ VSWebSiteEvents {
    VSWebSiteEvents^ get();
}
abstract VSWebSiteEvents : VSWebSiteEvents with get
ReadOnly Property VSWebSiteEvents As VSWebSiteEvents

Property Value

Type: VsWebSite.VSWebSiteEvents

A VSWebSiteEvents object.

Examples

The following example uses the VSWebSiteEvents property to add two event methods. This example is part of a larger example for the VSWebSite class overview.

C#

private void SolutionEvents_Opened()
{
    // When solution is opened, attach event handlers for projects
    foreach (Project proj in _applicationObject.Solution.Projects)
    {   // Only attach event handlers if it is a Web site
        if (proj.Object is VSWebSite)
        {
            ((VSWebSite)proj.Object).VSWebSiteEvents.WebReferencesEvents.WebReferenceAdded +=
                new _dispWebReferencesEvents_WebReferenceAddedEventHandler
                    (WebRefEvents_WebRefAdded);
            ((VSWebSite)proj.Object).VSWebSiteEvents.AssemblyReferencesEvents.AssemblyReferenceAdded += 
                new _dispAssemblyReferencesEvents_AssemblyReferenceAddedEventHandler
                    (AssemblyRefsEvents_AssemblyRefAdded);
        }
   }
}

See Also

VSWebSite
EnvDTE
VSWebSiteEvents
VsWebSite Namespace
Referencing Automation Assemblies and the DTE2 Object

Return to top