Sdílet prostřednictvím


AutomationEventArgs(AutomationEvent) Konstruktor

Definice

Inicializuje novou instanci AutomationEventArgs třídy .

public:
 AutomationEventArgs(System::Windows::Automation::AutomationEvent ^ eventId);
public AutomationEventArgs (System.Windows.Automation.AutomationEvent eventId);
new System.Windows.Automation.AutomationEventArgs : System.Windows.Automation.AutomationEvent -> System.Windows.Automation.AutomationEventArgs
Public Sub New (eventId As AutomationEvent)

Parametry

eventId
AutomationEvent

Identifikátor události.

Příklady

Následující kód ukazuje, jak zprostředkovatel model UI Automation může vytvořit AutomationEventArgs a vyvolat událost.

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

Platí pro