共用方式為


IVsWCFReferenceEvents Interface

Raises events for Windows Communication Foundation (WCF) service references.

Namespace:  Microsoft.VisualStudio.WCFReference.Interop
Assembly:  Microsoft.VisualStudio.WCFReference.Interop (in Microsoft.VisualStudio.WCFReference.Interop.dll)

Syntax

'宣告
<GuidAttribute("729D5091-E77F-4D0B-B03A-2310AD58DDC2")> _
<InterfaceTypeAttribute()> _
Public Interface IVsWCFReferenceEvents
[GuidAttribute("729D5091-E77F-4D0B-B03A-2310AD58DDC2")]
[InterfaceTypeAttribute()]
public interface IVsWCFReferenceEvents
[GuidAttribute(L"729D5091-E77F-4D0B-B03A-2310AD58DDC2")]
[InterfaceTypeAttribute()]
public interface class IVsWCFReferenceEvents
[<GuidAttribute("729D5091-E77F-4D0B-B03A-2310AD58DDC2")>]
[<InterfaceTypeAttribute()>]
type IVsWCFReferenceEvents =  interface end
public interface IVsWCFReferenceEvents

The IVsWCFReferenceEvents type exposes the following members.

Methods

  Name Description
Public method OnConfigurationChanged Raises the ConfigurationChanged event.
Public method OnMetadataChanged Raises the MetaDataChanged event.
Public method OnMetadataChanging Raises the MetaDataChanged event.
Public method OnReferenceGroupCollectionChanged Raises an event after a new reference is added or an existing reference is deleted.
Public method OnReferenceGroupCollectionChanging Raises an event after a new reference is added or an existing reference is deleted.
Public method OnReferenceGroupPropertiesChanged Raises an event after reference group properties (including name, namespace, proxy generation options and URL) for a particular reference group are changed.
Public method OnReferenceGroupPropertiesChanging Raises an event before reference group properties (including name, namespace, proxy generation options and URL) for a particular reference group are changed.

Top

Examples

The following example demonstrates a class that handles WCF service reference events.

/// Listens to referenceGroup events and notifies the controller of the events.
class ReferenceEventsListener : WCF.IVsWCFReferenceEvents, IDisposable
{
    private IExplorerController controller;
    private WCF.IVsWCFReferenceManager referenceManager;
    private uint cookie;
    private bool hasCookie = false;

    public ReferenceEventsListener(IExplorerController controller,
  WCF.IVsWCFReferenceManager referenceManager)
    {
        this.controller = controller;
        this.referenceManager = referenceManager;
        referenceManager.AdviseWCFReferenceEvents(this, out cookie);
            Debug.Assert(cookie != 0);
            hasCookie = true;
        }
    void WCF.IVsWCFReferenceEvents.OnMetadataChanged
 (WCF.IVsWCFReferenceGroup pReferenceGroup)
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFired, "IVsWCFReferenceEvents.OnMetadataChanged",
 pReferenceGroup.GetName()));
        controller.Update();
    }
    void WCF.IVsWCFReferenceEvents.OnMetadataChanging
 (WCF.IVsWCFReferenceGroup pReferenceGroup)
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFired, "IVsWCFReferenceEvents.OnMetadataChanging",
 pReferenceGroup.GetName()));
    }
    void WCF.IVsWCFReferenceEvents.OnReferenceGroupPropertiesChanged
 (WCF.IVsWCFReferenceGroup pReferenceGroup)
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFired,
 "IVsWCFReferenceEvents.OnReferenceGroupPropertiesChanged",
 pReferenceGroup.GetName()));
        controller.Update();
    }
    void WCF.IVsWCFReferenceEvents.OnReferenceGroupPropertiesChanging
 (WCF.IVsWCFReferenceGroup pReferenceGroup)
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFired,\"IVsWCFReferenceEvents.
 ReferenceGroupPropertiesChanging", pReferenceGroup.GetName())); 
    }
        void WCF.IVsWCFReferenceEvents.OnConfigurationChanged()
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFiredGeneric,
 "IVsWCFReferenceEvents.OnConfigurationChanged"));
        controller.Update();
    }
    void WCF.IVsWCFReferenceEvents.OnReferenceGroupCollectionChanged()
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFiredGeneric,
 "IVsWCFReferenceEvents.OnReferenceGroupCollectionChanged"));
        controller.Update();
    }
    void WCF.IVsWCFReferenceEvents.OnReferenceGroupCollectionChanging()
    {
        controller.Log(String.Format(CultureInfo.InvariantCulture,
 Resources.LogEventFiredGeneric,
 "IVsWCFReferenceEvents.OnReferenceGroupCollectionChanging"));
    }
}

See Also

Reference

Microsoft.VisualStudio.WCFReference.Interop Namespace