Hi. I'm recommend to U to use Reactive Extensions for windows phone.
With help of this third-party library Rx(by the way it was wrriten by one of the LINQ founder ) you can achive such ability to call service on one thread and observe result on another.
For example let get json data from service:
WebClient webClient = new WebClient();
webClient.Headers.Add("uid", LoginData.LoginName);
webClient.Headers.Add("pass", LoginData.Password);
webClient.Headers.Add("logonType", "0");
var eventStream = Observable.FromEventPattern<DownloadDataCompletedEventArgs>(webClient, "DownloadDataCompleted").
SubscribeOn(Scheduler.NewThread).Select(newData => newData.EventArgs.Result);
eventStream.ObserveOn(System.Threading.SynchronizationContext.Current).Subscribe(OnDatareceived,
ex =>
{
System.Windows.MessageBox.Show(ex.Message);
ViewModel.ViewModelLocator.Logger.Error(string.Empty, ex);
});
webClient.DownloadDataAsync(new Uri(ConfigurationManager.AppSettings["loginUrl"]));
weakClient.Dispose();
weakClient = null;
void OnDatareceived(byte[] data)
{
if(data!=null){
}
}