I\'ve read that the C# version is as follows:
Application.Current.Dispatcher.Invoke(
DispatcherPriority.Background,
new Action(delegate {
You've got two questions here, so i'm going to add two answers. Here, i'm answering "how to do DoEvents in WPF". Bea Stollnitz covers this on her blog, and here's the code in VB:
publicShared Sub WaitForPriority(priority As DispatcherPriority)
Dim frame As New DispatcherFrame()
Dim dispatcherOperation As DispatcherOperation = Dispatcher.CurrentDispatcher.BeginInvoke(priority, New DispatcherOperationCallback(ExitFrameOperation), frame)
Dispatcher.PushFrame(frame)
If dispatcherOperation.Status <> DispatcherOperationStatus.Completed Then
dispatcherOperation.Abort()
End If
End Sub
Private Shared Function ExitFrameOperation(obj As Object) As Object
(DirectCast(obj, DispatcherFrame)).[Continue] = False
Return Nothing
End Function