AutomationEventArgs.EventId 속성

정의

이벤트 식별자를 가져옵니다.Gets the event identifier.

public:
 property System::Windows::Automation::AutomationEvent ^ EventId { System::Windows::Automation::AutomationEvent ^ get(); };
public System.Windows.Automation.AutomationEvent EventId { get; }
member this.EventId : System.Windows.Automation.AutomationEvent
Public ReadOnly Property EventId As AutomationEvent

속성 값

이벤트 식별자입니다.The event identifier.

예제

다음 예제에서는 이벤트 처리기를 확인 합니다 EventId 이벤트의 이벤트를 적절 하 게 처리 합니다.In the following example, the event handler checks the EventId of the event and handles the event accordingly.

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

설명

클라이언트는 동일한를 사용 하 여 둘 이상의 이벤트에 대 한 이벤트 처리기를 추가 하는 경우 AutomationEventHandler 인스턴스를 EventId 이벤트 대리자를 처리 해야 하는 데 사용할 수 있습니다.If a client has added event handlers for more than one event using the same AutomationEventHandler instance, EventId can be used to identify the event that the delegate should process.

적용 대상