مشاركة عبر


VSWebSiteEvents الواجهة

وصولاً إلى أحداث مجموعات في مشروع موقع ويب.

مساحة الاسم:  VsWebSite
التجميع:  VsWebSite.Interop (في VsWebSite.Interop.dll)

بناء الجملة

'إقرار
<GuidAttribute("9F1B1C2C-FA11-44AB-A7DA-926FF1927C70")> _
Public Interface VSWebSiteEvents
[GuidAttribute("9F1B1C2C-FA11-44AB-A7DA-926FF1927C70")]
public interface VSWebSiteEvents
[GuidAttribute(L"9F1B1C2C-FA11-44AB-A7DA-926FF1927C70")]
public interface class VSWebSiteEvents
[<GuidAttribute("9F1B1C2C-FA11-44AB-A7DA-926FF1927C70")>]
type VSWebSiteEvents =  interface end
public interface VSWebSiteEvents

ملاحظات

يتم الوصول إلى هذه الواجهة مع VSWebSiteEventsخاصية VSWebSiteكائن، الذي يمكن الحصول على فقط من خلال مرجع لمشروع ‏‫Visual Studio الحالي، كما في المثال التالي:

Dim ws As VsWebSite.VSWebSite = DTE.Solution.Projects.Item(1).Object

ملاحظة

الوظيفة التي يوفرها th هو الفئة هو متوفرة في إصدارات Studio Vهوual بدءاً من Vهوual Studio 2005. هو غير متوفرة في Vهوual ويب المطور Express Edition.

أمثلة

نموذج التالي عرض وحدة نمطية? الماكرو كيف إلى الاشتراك إلى VSWebSiteالأحداث. إلى استخدام وحدة نمطية?، قم بفتح مشروع موقع ويب في ‏‫Visual Studio، ومن إلى ols القائمة، قم بفتح الماكرو IDE. قم بإنشاء وحدة نمطية جديدة و لصق نموذج التعليمة البرمجية في وحدة نمطية?.

يجب عليك أيضا إضافة مرجع إلى تجميع VsWebSite.Interop إلى وحدة نمطية?. يهيّئ الاشتراك حدث بواسطة وضع المؤشر في InitEvents()الطريقة والضغط على F5. لاختبار كل حدث، قم بتنفيذ إجراء المحدد في مشروع موقع ويب الخاص بك. لمزيد من المعلومات، انظر كيفية القيام بما يلي: أحداث مؤشر في ماكرو.

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports VsWebSite
Imports System.Diagnostics

Public Module VsWS_Events
    ' Initialize the VsWebSite and the Events
    Sub InitAssemblyRefsEvents()
        ' Get a reference to the first Web site 
        ' in the current solution
        Dim ws As VsWebSite.VSWebSite = _
            DTE.Solution.Projects.Item(1).Object

        ' Attach the Web site events to module events
        AssemblyRefsEvents = _
            ws.VSWebSiteEvents.AssemblyReferencesEvents
    End Sub

    ' Declare the event
    ' The macro IDE requires the attribute 
    ' in order to trap the events
    <System.ContextStaticAttribute()> _
    Public WithEvents AssemblyRefsEvents As _
        VsWebSite.AssemblyReferencesEvents

    <System.ContextStaticAttribute()> _
    Public WithEvents MiscEvents As _
        VsWebSite.WebSiteMiscEvents

    <System.ContextStaticAttribute()> _
    Public WithEvents WebRefsEvents As _
        VsWebSite.WebReferencesEvents

    <System.ContextStaticAttribute()> _
    Public WithEvents WebSvcsEvents As _
        VsWebSite.WebServicesEvents

    ' Handler for the AssemblyReferenceAdded event
    ' Test: Add an Assembly Reference to your Web site project
    Private Sub AssemblyRefAdded _
        (ByVal ref As VsWebSite.AssemblyReference) _
            Handles AssemblyRefsEvents.AssemblyReferenceAdded

        ' Display the name of the added reference
        MsgBox("Assembly Added: " & ref.Name)
    End Sub

    ' Handler for the After Refresh Folder event
    ' Test: Refresh a folder in your Web site project
    Private Sub AfterRefresh _
        (ByVal ref As Object) _
            Handles MiscEvents.OnAfterFolderRefresh

        ' Display the folder as text
        MsgBox("Folder Refreshed: " & ref.ToString())
    End Sub

    ' Handler for the Web Reference Added event
    ' Test: Add a Web Reference to your Web site project
    Private Sub WebRefAdded _
        (ByVal ref As VsWebSite.WebReference) _
            Handles WebRefsEvents.WebReferenceAdded

        ' Display the name of the added reference
        MsgBox("Web Reference Added: " & ref.Name)
    End Sub

    ' Handler for the Web Service Added event
    ' Test: Add a Web service to your Web site project
    Private Sub WebSvcAdded _
        (ByVal ref As VsWebSite.WebService) _
            Handles WebSvcsEvents.WebServiceAdded

        ' Display the name of the added item
        MsgBox("Web Service Added: " & ref.Name)
    End Sub
End Module

راجع أيضًَا

المرجع

VSWebSiteEvents الأعضاء

VsWebSite مساحة الاسم

DTE

VsWebSite

AssemblyReferencesEvents

WebReferencesEvents

WebServicesEvents

WebSiteMiscEvents

موارد أخرى

التنفيذ التلقائي والمرجع الامتداد

التجميعات التنفيذ التلقائي المرجعي وكائن DTE2

وحدات ماكرو Visual Studio

إنشاء الوظائف الإضافية ومعالجات

كيفية القيام بما يلي: أحداث مؤشر في ماكرو