AutomationEvent Classe

Definição

Identifica um evento de Automatização da Interface de Utilizador.

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
Herança
AutomationEvent

Exemplos

No exemplo seguinte de handler de eventos, os AutomationEvent argumentos in the event são comparados com os AutomationEvent que identificam o evento invocado.

/// <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

Observações

Identificadores destes tipos encontram-se como campos em várias classes para identificar eventos; por exemplo, InvokedEvent. Também se encontram nos argumentos de eventos passados aos clientes de Automatização da Interface de Utilizador.

Não é possível criar eventos personalizados.

Propriedades

Name Description
Id

Obtém o identificador numérico subjacente.

(Herdado de AutomationIdentifier)
ProgrammaticName

Recebe o nome programático registado.

(Herdado de AutomationIdentifier)

Métodos

Name Description
CompareTo(Object)

Compara isto AutomationIdentifier com outro AutomationIdentifier.

(Herdado de AutomationIdentifier)
Equals(Object)

Devolve um valor que indica se o fornecido AutomationIdentifier é equivalente a este AutomationIdentifier.

(Herdado de AutomationIdentifier)
GetHashCode()

Devolve o código hash deste identificador de Automatização da Interface de Utilizador.

(Herdado de AutomationIdentifier)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
LookupById(Int32)

Recupera um AutomationEvent que encapsula o identificador numérico especificado.

MemberwiseClone()

Cria uma cópia superficial do atual Object.

(Herdado de Object)
ToString()

Devolve uma cadeia que representa o objeto atual.

(Herdado de Object)

Aplica-se a

Ver também