I am trying to translate the following C# snippet to VB:
public bool ShowHandlerDialog(string message)
{
Message = message;
Visibility = Visibility.Visible;
_parent.IsEnabled = false;
_hideRequest = false;
while (!_hideRequest)
{
// HACK: Stop the thread if the application is about to close
if (this.Dispatcher.HasShutdownStarted ||
this.Dispatcher.HasShutdownFinished)
{
break;
}
// HACK: Simulate "DoEvents"
this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
Thread.Sleep(20);
}
return _result;
}
But the translation is giving an error on this line:
this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
The translation is:
Me.Dispatcher.Invoke(DispatcherPriority.Background, New ThreadStart(Function() Do End Function))
Which doesnt seem to convert correctly the bit after New ThreadStart. Can somebody please explain what 'delegate {}' does in
new ThreadStart(delegate {}));
and how I might correct the translation error? Thanks for any advice!