語言

AutomationEvent 類別

定義

識別一個 使用者介面自動化 事件。

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
繼承
AutomationEvent

範例

在以下範例事件處理程序中, AutomationEvent 事件中的參數與識別呼叫事件的參數進行比較 AutomationEvent 。

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

備註

這類識別碼以欄位形式出現在不同類別中,用以識別事件;例如, InvokedEvent。 它們也出現在傳遞給 使用者介面自動化 客戶端的事件參數中。

無法建立自訂事件。

屬性

名稱 Description
Id

取得底層的數字識別碼。

(繼承來源 AutomationIdentifier)
ProgrammaticName

取得註冊的程式化名稱。

(繼承來源 AutomationIdentifier)

方法

名稱 Description
CompareTo(Object)

將此 AutomationIdentifier 與另一項 AutomationIdentifier。

(繼承來源 AutomationIdentifier)
Equals(Object)

回傳一個值,表示所提供的 AutomationIdentifier 是否等價於此 AutomationIdentifier。

(繼承來源 AutomationIdentifier)
GetHashCode()

回傳此 使用者介面自動化 識別碼的雜湊碼。

(繼承來源 AutomationIdentifier)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
LookupById(Int32)

取得封裝指定數值識別碼的 。AutomationEvent

MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於

另請參閱