IRawElementProviderFragment.GetRuntimeId Método

Definición

Recupera el identificador en tiempo de ejecución de un elemento.

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

Devoluciones

Int32[]

Identificador único en tiempo de ejecución del elemento.

Ejemplos

En el código de ejemplo siguiente se muestra una implementación de este método por un elemento dentro de un fragmento, como un elemento dentro de un cuadro de lista. El elemento tiene su propio identificador único dentro de esta instancia del fragmento y el AppendRuntimeId valor garantiza que el identificador devuelto por el método sea único en el árbol de automatización de la interfaz de usuario.

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

Comentarios

Las implementaciones deben devolverse null para un elemento que corresponde a un identificador de ventana. Otros elementos deben devolver una matriz que contenga AppendRuntimeId, seguida de un valor único dentro del fragmento.

Es responsabilidad del proveedor garantizar la unicidad dentro del fragmento; por ejemplo, cada elemento de una lista debe estar numerado individualmente. El motor de automatización de la interfaz de usuario garantiza que el identificador sea único entre todas las instancias mediante la traducción del AppendRuntimeId valor.

Se aplica a

Consulte también