Вопрос

I am trying two update UI from another thread:

Me.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Normal, New Action(AddressOf RefreshDisplay))

The problem is that I need t0 pass two arguments to RefreshDisplay

Private Sub RefreshDisplay(ByVal n1 As String, ByVal n2 As String)
 .
 .
 .
 .
End Sub
Это было полезно?

Решение

You need to use a delegate type that matches the target method. That can't be Action, that's a delegate for a method that takes no arguments. Fix:

    Me.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Normal, _
                         New Action(Of String, String)(AddressOf RefreshDisplay), _
                         "foo", "bar")

Don't forget to actually pass those two arguments, I of course had to guess at them.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top