考虑下面的代码:
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函数相同的方式运行,但带有参数。
发布于 2012-08-22 12:32:39
有几个可用于BeginInvoke的覆盖
Dispatcher.BeginInvoke Method
您可能正在考虑使用Dispatcher.BeginInvoke Method (Delegate, DispatcherPriority, Object[])
在创建调度程序的线程上,以指定的优先级使用指定的参数异步执行指定的委托。
https://stackoverflow.com/questions/12066293
复制相似问题