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

'Declaration
ReadOnly Property VSWebSiteEvents As VSWebSiteEvents
'Usage
Dim instance As VSWebSite 
Dim value As VSWebSiteEvents 

value = instance.VSWebSiteEvents
VSWebSiteEvents VSWebSiteEvents { get; }
property VSWebSiteEvents^ VSWebSiteEvents {
    VSWebSiteEvents^ get ();
}
function get VSWebSiteEvents () : 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);
        }
   }
}

.NET Framework Security

See Also

Reference

VSWebSite Interface

VSWebSite Members

VsWebSite Namespace

VSWebSite

EnvDTE

VSWebSiteEvents

Other Resources

Referencing Automation Assemblies and the DTE2 Object