AutomationEvent Klasa

Definicja

Identyfikuje zdarzenie automatyzacja interfejsu użytkownika.

public ref class AutomationEvent : System::Windows::Automation::AutomationIdentifier
public class AutomationEvent : System.Windows.Automation.AutomationIdentifier
type AutomationEvent = class
    inherit AutomationIdentifier
Public Class AutomationEvent
Inherits AutomationIdentifier
Dziedziczenie
AutomationEvent

Przykłady

W poniższym przykładowym programie obsługi AutomationEvent zdarzeń argumenty w zdarzeniu są porównywane z elementem AutomationEvent identyfikującym wywołane zdarzenie.

/// <summary>
/// AutomationEventHandler delegate.
/// </summary>
/// <param name="src">Object that raised the event.</param>
/// <param name="e">Event arguments.</param>
private void OnUIAutomationEvent(object src, AutomationEventArgs e)
{
    // Make sure the element still exists. Elements such as tooltips
    // can disappear before the event is processed.
    AutomationElement sourceElement;
    try
    {
        sourceElement = src as AutomationElement;
    }
    catch (ElementNotAvailableException)
    {
        return;
    }
    if (e.EventId == InvokePattern.InvokedEvent)
    {
        // TODO Add handling code.
    }
    else
    {
        // TODO Handle any other events that have been subscribed to.
    }
}
''' <summary>
''' AutomationEventHandler delegate.
''' </summary>
''' <param name="src">Object that raised the event.</param>
''' <param name="e">Event arguments.</param>
Private Sub OnUIAutomationEvent(ByVal src As Object, ByVal e As AutomationEventArgs)
    ' Make sure the element still exists. Elements such as tooltips can disappear
    ' before the event is processed.
    Dim sourceElement As AutomationElement
    Try
        sourceElement = DirectCast(src, AutomationElement)
    Catch ex As ElementNotAvailableException
        Exit Sub
    End Try
    If e.EventId Is InvokePattern.InvokedEvent Then
        ' TODO Add handling code.
    Else
    End If
    ' TODO Handle any other events that have been subscribed to.
    Console.WriteLine("Event: " & e.EventId.ProgrammaticName)
End Sub

Uwagi

Identyfikatory tych typów są znajdowane jako pola w różnych klasach do identyfikowania zdarzeń; na przykład InvokedEvent. Znajdują się one również w argumentach zdarzeń przekazywanych do klientów automatyzacja interfejsu użytkownika.

Nie można tworzyć zdarzeń niestandardowych.

Właściwości

Id

Pobiera podstawowy identyfikator liczbowy.

(Odziedziczone po AutomationIdentifier)
ProgrammaticName

Pobiera zarejestrowaną nazwę programową.

(Odziedziczone po AutomationIdentifier)

Metody

CompareTo(Object)

Porównuje to AutomationIdentifier z innym AutomationIdentifierelementem .

(Odziedziczone po AutomationIdentifier)
Equals(Object)

Zwraca wartość wskazującą, czy podany AutomationIdentifier element jest odpowiednikiem tego AutomationIdentifierelementu .

(Odziedziczone po AutomationIdentifier)
GetHashCode()

Zwraca kod skrótu dla tego identyfikatora automatyzacja interfejsu użytkownika.

(Odziedziczone po AutomationIdentifier)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
LookupById(Int32)

Pobiera element AutomationEvent , który hermetyzuje określony identyfikator liczbowy.

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też