IRawElementProviderAdviseEvents.AdviseEventAdded Method (Int32, Int32[])

 

Notifies the UI Automation provider when a UI Automation client begins listening for a specific event, including a property-changed event.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

void AdviseEventAdded(
	int eventId,
	int[] properties
)

Parameters

eventId
Type: System.Int32

The identifier of the event being added.

properties
Type: System.Int32[]

The identifiers of the properties being added, or null if the event listener being added is not listening for property events.

This method enables the provider to reduce overhead by raising only events that are being listened for.

The eventId can be compared with the Id of an AutomationEvent such as WindowClosedEvent. You can also obtain the AutomationEvent by using LookupById.

The following example adds to a list of property changes that have been subscribed to.

void IRawElementProviderAdviseEvents.AdviseEventAdded(int eventId, 
                                                      int[] properties)
{
    if (eventId == AutomationElement.AutomationPropertyChangedEvent.Id)
    {
        foreach (int i in properties)
        {
            AutomationProperty property = AutomationProperty.LookupById(i);
            // Add to an ArrayList.
            subscribedProperties.Add(property);
        }
    }
}

.NET Framework
Available since 3.0
Return to top
Show: