Upraviť

Zdieľať cez


IRawElementProviderAdviseEvents.AdviseEventRemoved(Int32, Int32[]) Method

Definition

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

public:
 void AdviseEventRemoved(int eventId, cli::array <int> ^ properties);
public void AdviseEventRemoved (int eventId, int[] properties);
abstract member AdviseEventRemoved : int * int[] -> unit
Public Sub AdviseEventRemoved (eventId As Integer, properties As Integer())

Parameters

eventId
Int32

The identifier of the event being removed.

properties
Int32[]

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

Examples

The following example removes property changes from a list of those that have been subscribed to.

void IRawElementProviderAdviseEvents.AdviseEventRemoved(int eventId,
                                                        int[] properties)
{
    if (eventId == AutomationElement.AutomationPropertyChangedEvent.Id)
    {
        Console.WriteLine("Property changes no longer subscribed to:");
        foreach (int i in properties)
        {
            AutomationProperty property = AutomationProperty.LookupById(i);
            // Remove from an ArrayList.
            subscribedProperties.Remove(property);
        }
    }
}
Sub AdviseEventRemoved(ByVal eventId As Integer, ByVal properties() As Integer) _
    Implements IRawElementProviderAdviseEvents.AdviseEventRemoved

    If eventId = AutomationElement.AutomationPropertyChangedEvent.Id Then
        For Each i As Integer In properties
            Dim autoProperty As AutomationProperty = AutomationProperty.LookupById(i)
            ' Remove from ArrayList.
            subscribedProperties.Remove(autoProperty)
        Next
    End If

End Sub

Remarks

This method enables the UI Automation provider to reduce overhead by not raising events that are no longer 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.

Applies to