DispatcherObject.VerifyAccess Método

Definição

Impõe que o thread de chamada tenha acesso a isso 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 isso 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 no qual foi Dispatcher criado pode acessar o DispatcherObject.

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

A diferença entre CheckAccess e VerifyAccess é que CheckAccess retorna um Boolean 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 isso DispatcherObject.

Aplica-se a