Share via


AutomationInteropProvider.RaiseAutomationEvent Méthode

Définition

Déclenche un événement modèle ou un événement personnalisé.

public:
 static void RaiseAutomationEvent(System::Windows::Automation::AutomationEvent ^ eventId, System::Windows::Automation::Provider::IRawElementProviderSimple ^ provider, System::Windows::Automation::AutomationEventArgs ^ e);
public static void RaiseAutomationEvent (System.Windows.Automation.AutomationEvent eventId, System.Windows.Automation.Provider.IRawElementProviderSimple provider, System.Windows.Automation.AutomationEventArgs e);
static member RaiseAutomationEvent : System.Windows.Automation.AutomationEvent * System.Windows.Automation.Provider.IRawElementProviderSimple * System.Windows.Automation.AutomationEventArgs -> unit
Public Shared Sub RaiseAutomationEvent (eventId As AutomationEvent, provider As IRawElementProviderSimple, e As AutomationEventArgs)

Paramètres

eventId
AutomationEvent

Identificateur de l'événement.

provider
IRawElementProviderSimple

L’élément associé à l’événement.

e
AutomationEventArgs

Informations relatives à l'événement.

Exemples

/// <summary>
/// Raises an event when a control is invoked.
/// </summary>
/// <param name="provider">The UI Automation provider for the control.</param>
private void RaiseInvokeEvent(IRawElementProviderSimple provider)
{
    if (AutomationInteropProvider.ClientsAreListening)
    {
        AutomationEventArgs args = 
            new AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent);
        AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, 
            provider, args);
    }
}
''' <summary>
''' Raises an event when a control is invoked.
''' </summary>
''' <param name="provider">The UI Automation provider for the control.</param>
Private Sub RaiseInvokeEvent(ByVal provider As IRawElementProviderSimple)
    If AutomationInteropProvider.ClientsAreListening Then
        Dim args As New AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent)
        AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, provider, args)
    End If

End Sub

Remarques

Les événements de modèle ne doivent pas être déclenchés uniquement par une implémentation de modèle. Par exemple, un InvokedEvent doit être déclenché chaque fois que le contrôle est appelé, via Invoke ou via une entrée de souris ou de clavier. De cette façon, les clients peuvent être informés des événements système.

S’applique à

Voir aussi