Я пытаюсь перевести следующий фрагмент кода C # в 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;
}
Но перевод выдает ошибку в этой строке:
this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
Перевод:
Me.Dispatcher.Invoke(DispatcherPriority.Background, New ThreadStart(Function() Do End Function))
Который, кажется, не преобразует правильно бит после New ThreadStart Может кто-нибудь объяснить, что делает "delegate {}
" в
new ThreadStart(delegate {}));
а как мне исправить ошибку перевода? Спасибо за любой совет!