I have a Windows Phone 7 application (Silverlight-based) that sends a web request and receives a web response. It works fine – I am using BeginGetReponse and an AsyncCallback to call EndGetResponse.
However, I need to wait for the response to be fully received, so that I can fill a collection with the data from the response.
What would be the best way to wait for the operation to complete?
You should fill in your data in your callback, after you call EndGetResponse:
If your need to fill in your data on the UI thread, you can return to UI thread like this:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.endgetresponse.aspx has more elaborate sample.