Share via


DWMSNamedValuesEvents.OnValueChanged (C#)

banner art

Previous Next

DWMSNamedValuesEvents.OnValueChanged (C#)

The OnValueChanged event specifies an event handler for event notices raised by the server when a property on your plug-in is added, removed, or modified.

Syntax

  OnValueChanged += new DWMSNamedValuesEvents_OnValueChangedEventHandler(
EventHandler);

Remarks

When the Microsoft.WindowsMediaServices.Interop assembly is created, a number of objects are automatically generated to wrap low-level COM connection point architecture implemented by the server in the WMSNamedValues class. For example, you can use the DWMSNamedValuesEvents_OnValueChangedEventHandler object to specify a handler for changes to plug-in properties. You must create the event handler inside of the plug-in. The server raises event notices when your plug-in calls any of the following properties and methods:

You typically initialize plug-in properties when you register a plug-in, but you can add, remove, or modify them after they are initialized. Common properties include copyright information, the name of the author, descriptive text about the plug-in, property page monikers, and more. For more information, see Registering Plug-in Properties.

You cannot handle changes to properties made by using the server object model outside of your plug-in. The event sink can only handle changes made by your plug-in.

Example Code

The IWMSBasicPlugin.InitializePlugin method sends a WMSNamedValues object to your plug-in. You can use this object to specify an event handler as illustrated by the following example, in which the name of the event handler is PluginNameValueChangeHandler.

public virtual void InitializePlugin( IWMSContext ServerContext, 
                                      WMSNamedValues NamedValues,
                                      IWMSClassObject ClassFactory)
{

  // Hook into the COM event by using the 
  // DWMSNamedValuesEvents_OnValueChangedEventHandler
  // object to identify an event handler.
  NamedValues.OnValueChanged += 
         new DWMSNamedValuesEvents_OnValueChangedEventHandler(
                                         PluginNameValueChangeHandler
                                         );

}

The event handler is a separate function that is called by the .NET runtime when the server raises an appropriate event.

void PluginNameValueChangeHandler()
{
    // TODO: Handle the event notice.

}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next