AutomationEvent Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Identifie un événement UI Automation.
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
- Héritage
Exemples
Dans l’exemple de gestionnaire d’événements suivant, les AutomationEvent arguments de l’événement sont comparés à ceux AutomationEvent qui identifient l’événement appelé.
/// <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
Remarques
Les identificateurs de ces types sont trouvés en tant que champs dans différentes classes pour identifier les événements ; par exemple, InvokedEvent. Ils sont également trouvés dans les arguments d’événement passés à UI Automation clients.
Il n’est pas possible de créer des événements personnalisés.
Propriétés
| Nom | Description |
|---|---|
| Id |
Obtient l’identificateur numérique sous-jacent. (Hérité de AutomationIdentifier) |
| ProgrammaticName |
Obtient le nom programmatique inscrit. (Hérité de AutomationIdentifier) |
Méthodes
| Nom | Description |
|---|---|
| CompareTo(Object) |
Compare cela AutomationIdentifier à un autre AutomationIdentifier. (Hérité de AutomationIdentifier) |
| Equals(Object) |
Retourne une valeur indiquant si l’élément fourni AutomationIdentifier est équivalent à celui-ci AutomationIdentifier. (Hérité de AutomationIdentifier) |
| GetHashCode() |
Retourne le code de hachage de cet identificateur UI Automation. (Hérité de AutomationIdentifier) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| LookupById(Int32) |
Récupère un AutomationEvent élément qui encapsule l’identificateur numérique spécifié. |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |