I am building a WP7 app in which I am having a list of objects. Object have properties like URL, filename. So the problem is how can I pass the current object to async callback method so that after download i can save it with filename. I don’t want to take global variable for filename.
Secondly I want to show progress-bar with text 1 0f 5 downloaded. How exactly can I achieve this.
Thanks in Advance!
Just create helper DTO class that will store all information you need.
For example,
If you use Webclient, use parameter token in methods DownloadStringAsync or OpenReadAsync
Details on these methods:
http://msdn.microsoft.com/en-us/library/ms144203(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/ms144212(v=vs.95)
If you use HttpWebRequest, then use parameter state in method BeginGetResponse.
Details on that method:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse(v=vs.95).aspx