Wednesday, August 15, 2012

RIA service call from background thread

RIA service call from background thread

I am working on Silverlight app, which is using RIA service. I have lots of data to load when app is running, and all data must be shown on UI.
I am loading data with different queries, and there is no sequential dependency between loading pieces.
As data arrives, is started to be drawn, mainly rectangles and lines based on data.
Processing data is taking too much time. I am using fiddler to see http requests, and got following results. Taking data from DB and receiving it takes about 1.5 seconds. But after receiving response it is taking about 6 seconds to fire completed event. At that time UI thread is busy with calculations and rendering.
I tried to make Service calls with background worker, but all completed events are firing on UI thread.
Is there any way do make service calls and process received data from non UI thread?

EDIT:
I commented some code, which was drawing some elements on UI and it takes 0.4 seconds to process data, instead of previous 6, so the reason is on busy UI thread, which is processing received data before firing completed event.

Thanks.

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog