考虑这段代码:
Dim MyDispatcher = Windows.Threading.Dispatcher.CurrentDispatcher
Public NormalUpdateThread As System.Threading.Thread
Private Delegate Sub UpdateUIDelegate()
我称我的方法为
MyDispatcher.BeginInvoke(DispatcherPriority.Background, New UpdateUIDelegate(AddressOf doProgressbarStuff))
和函数 doProgressbarStuff
Public Sub doProgressbarStuff()
customprogressbar1.Increment(1)
customprogressbar1.Content = "Elapsed Time: " & GetTime(elapsedSeconds) & " | " & " Remaining Time:GetRemainingtime() | " & progressBarEdit1.Value & " of " & My.Settings.maindatatable.Rows.Count & " Products Updated |" & " Completion:" & Math.Round((progressBarEdit1.Value / My.Settings.maindatatable.Rows.Count), 3) * 100 & "%"
End Sub
上面的代码工作得很好。问题是我编写了一个新的 doProgressbarStuff 函数,它接受三个参数,但我不知道如何使用 Addressof 调用它,或者让它以与上述 doProgressbarStuff 函数相同的方式运行,但带有参数。