I'm trying to use the TPL in my SL5 application to simplify the Async Service calls.
I'm calling the following from my MainPage code behind, with the method being called being an async void that does the work with the service proxy. An Cross-Thread access exception always gets thrown for this code, and none of the asyn void code is reached, even though I'm not trying to interact with the UI:
var result = Task.Factory.StartNew(WCFServiceQueryHelper.StoreData);
Am I missing something, or is there a better way to perform this. Basically I need to use this static method (WCFServiceQueryHelper.Sto
reData), wait for it to complete, without blocking the UI thread, then continue to the next method after handling any exception caught.
This is to replace all the direct service calls, and callback events in the mainpage code, as it gets very messy. The static method (WCFServiceHelper) will use async/await and interact with the ServiceProxy, meaning the MainPage code can simply call this static method, and when complete, move onto the next method.