DispatcherObject.VerifyAccess Método

Definição

Impõe que o thread de chamada tenha acesso a este DispatcherObject.

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

Exceções

O thread de chamada não tem acesso a este DispatcherObject.

Exemplos

O exemplo a seguir usa VerifyAccess para determinar se um thread tem acesso ao thread no qual um Button foi criado. Se o thread de chamada não tiver acesso, um InvalidOperationException será gerado.

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

Comentários

Somente o thread Dispatcher no qual foi criado pode acessar o DispatcherObject.

Qualquer thread pode verificar se ele tem acesso a este DispatcherObject.

A diferença entre CheckAccess e VerifyAccess é que CheckAccess retorna um booliano que especifica se o thread de chamada tem acesso a isso DispatcherObject e VerifyAccess gera uma exceção se o thread de chamada não tem acesso a este DispatcherObject.

Aplica-se a