DispatcherObject.VerifyAccess Yöntem

Tanım

Çağıran iş parçacığının bu DispatcherObjectöğesine erişmesini zorlar.

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

Özel durumlar

çağıran iş parçacığının bu DispatcherObjectöğesine erişimi yok.

Örnekler

Aşağıdaki örnek, bir iş parçacığının oluşturulduğu iş parçacığına VerifyAccess erişimi olup olmadığını belirlemek için kullanırButton. Çağıran iş parçacığının erişimi yoksa, bir InvalidOperationException oluşturulur.

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

Açıklamalar

Yalnızca üzerinde oluşturulduğu iş parçacığına DispatcherDispatcherObjecterişebilir.

Herhangi bir iş parçacığı, bu DispatcherObjectöğesine erişimi olup olmadığını denetleyebiliyor.

ile arasındaki CheckAccess fark, çağıran iş parçacığının VerifyAccess buna CheckAccess erişimi olup olmadığını belirten bir Boole döndürmesi ve DispatcherObject çağıran iş parçacığının bu öğesine erişimi yoksa bir özel durum oluşturmasıdırVerifyAccess.DispatcherObject

Şunlara uygulanır