Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Asychronous Thread
7 replies. Latest Post by bryant on November 4, 2009.
(0)
nz
Member
9 points
14 Posts
11-04-2009 5:43 PM |
Guys, Need help with using Asychronous Thread in silverlight ? I try to use a ParameterizedThreadStart, because I got a parameterized method. Can anyone kindly tell me how to use it?
many thx
bryant
Star
9937 points
1,629 Posts
11-04-2009 5:46 PM |
You'd be better off using the BackgroundWorker since you can pass in parameters to it.
11-04-2009 6:37 PM |
Could u simply explain how BackgroundWorker pass parameters? I think it DoWork() take a event handler.
11-04-2009 6:49 PM |
You call worker.RunWorkerAsync(object parameter) and in the do work event handler you can grab the object from the Argument property on DoWorkEventArgs.
11-04-2009 6:59 PM |
It seems only working for one parameter, how about two?
11-04-2009 7:09 PM |
I got a error with message in DoWork(), could u please explain why this will happen
Invalid cross-thread access.
11-04-2009 8:14 PM |
You can't set things in your UI from code in the background thread (or any thread except the UI thread).
What are you trying to accomplish in DoWork?
11-04-2009 8:16 PM |
For two parameters just create your own class that has the two parameters or use a KeyValuePair.