IRawElementProviderFragment.GetRuntimeId Metodo

Definizione

Recupera l'identificatore di runtime di un elemento.

public:
 cli::array <int> ^ GetRuntimeId();
public int[] GetRuntimeId ();
abstract member GetRuntimeId : unit -> int[]
Public Function GetRuntimeId () As Integer()

Restituisce

Int32[]

Identificatore di runtime univoco dell'elemento.

Esempio

Il codice di esempio seguente illustra un'implementazione di questo metodo da parte di un elemento all'interno di un frammento, ad esempio un elemento all'interno di una casella di riepilogo. L'elemento ha un proprio identificatore univoco all'interno di questa istanza del frammento e il AppendRuntimeId valore garantisce che l'identificatore restituito dal metodo sia univoco nell'albero Automazione interfaccia utente.

/// <summary>
/// Gets the runtime identifier of the UI Automation element.
/// </summary>
/// <remarks>
/// myID is a unique identifier for the item within this instance of the list.
/// </remarks>
public int[] GetRuntimeId()
{
    return new int[] { AutomationInteropProvider.AppendRuntimeId, myID };
}
''' <summary>
''' Gets the runtime identifier of the UI Automation element.
''' </summary>
''' <remarks>
''' myID is a unique identifier for the item within this instance of the list.
''' </remarks>
Public Function GetRuntimeId() As Integer() _
    Implements IRawElementProviderFragment.GetRuntimeId

    Return New Integer() {AutomationInteropProvider.AppendRuntimeId, myID}

End Function 'GetRuntimeId

Commenti

Le implementazioni devono restituire null per un elemento che corrisponde a un handle di finestra. Gli altri elementi devono restituire una matrice che contiene AppendRuntimeId, seguita da un valore univoco all'interno del frammento.

È responsabilità del provider garantire l'univocità all'interno del frammento; Ad esempio, ogni elemento di un elenco deve essere numerato singolarmente. Il motore di Automazione interfaccia utente garantisce che l'identificatore sia univoco tra tutte le istanze convertendo il AppendRuntimeId valore.

Si applica a

Vedi anche