DispatcherObject.VerifyAccess Método

Definição

Faz cumprir que o thread que chama tem acesso a este DispatcherObject.

public:
 void VerifyAccess();
public void VerifyAccess();
member this.VerifyAccess : unit -> unit
Public Sub VerifyAccess ()

Exceções

o thread que chama não tem acesso a este DispatcherObject.

Exemplos

O exemplo seguinte serve VerifyAccess para determinar se um thread tem acesso ao thread onde a Button foi criado. Se o thread que chama não tiver acesso, um InvalidOperationException é lançado.

// Check if this thread has access to this object.
theButton.VerifyAccess();

// Thread has access to the object, so update the UI.
UpdateButtonUI(theButton);
' Check if this thread has access to this object.
theButton.VerifyAccess()

' Thread has access to the object, so update the UI.
UpdateButtonUI(theButton)

Observações

Apenas o thread em que foi criado Dispatcher pode aceder ao DispatcherObject.

Qualquer tópico pode verificar se tem acesso a isto DispatcherObject.

A diferença entre CheckAccess e é que CheckAccess devolve um Booleano que especifica se o thread que chama tem acesso a isto DispatcherObject e VerifyAccess lança uma exceção se o thread que chama não tiver acesso a este DispatcherObjectVerifyAccess .

Aplica-se a