IRawElementProviderAdviseEvents.AdviseEventRemoved(Int32, Int32[]) Metoda

Definicja

Powiadamia dostawcę automatyzacja interfejsu użytkownika, gdy klient automatyzacja interfejsu użytkownika przestaje nasłuchiwać określonego zdarzenia, w tym zdarzenie zmienione przez właściwość.

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())

Parametry

eventId
Int32

Identyfikator usuwanego zdarzenia.

properties
Int32[]

Identyfikatory właściwości, które są usuwane, lub null jeśli odbiornik zdarzeń, który jest usuwany, nie nasłuchuje zdarzeń właściwości.

Przykłady

Poniższy przykład usuwa zmiany właściwości z listy tych, które zostały zasubskrybowane.

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

Uwagi

Ta metoda umożliwia dostawcy automatyzacja interfejsu użytkownika zmniejszenie nakładu pracy, nie wywołując zdarzeń, dla których nie są już nasłuchiwane.

Element eventId można porównać z elementem Id takim AutomationEvent jak WindowClosedEvent. Możesz również uzyskać obiekt AutomationEvent przy użyciu polecenia LookupById.

Dotyczy