开发者

Issuing and handling asynchronous webservice requests in a Thread [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

开发者_C百科 Improve this question

My silverlight application has a piece of code that issues multiple asynchronous requests to a web service and fills a collection from the data it returns. Is it possible to move the entire issuing (multiple calls) and handling all the responses to a single background thread. The purpose is to make UI faster.


Yes potentially.

You can set up a background worker object and pass into it the very object that will be making the multiple async' calls.The background worker class has a method called 'RunWorkerAsync(object)'.

Background Worker Class MSDN

Everything you need to know about this class is found on the link above. Be sure to read the the remarks section.

To get you started look here ...

You must be careful not to manipulate any user-interface objects in your DoWork event handler. Instead, communicate to the user interface through the ProgressChanged and RunWorkerCompleted events. < MSDN

To set up for a background operation, add an event handler for the DoWork event. Call your time-consuming operation in this event handler. To start the operation, call RunWorkerAsync. To receive notifications of progress updates, handle the ProgressChanged event. To receive a notification when the operation is completed, handle the RunWorkerCompleted event. < MSDN

Lastly ... Silverlight Performance Tips on MSDN

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜