burusera
burusera

Reputation: 189

WinRT: downloading file

I want to download file from server and show the progress of loading. How may I do this?

For downloading I use this:

HttpClient client = new HttpClient();
Stream response = await client.GetStreamAsync(url);

But I don't know how to get size of downloading file and don't know how much it was downloaded Thanks for any help

Upvotes: 2

Views: 3182

Answers (1)

Access Denied
Access Denied

Reputation: 9491

HttpClient client = new HttpClient();

HttpResponseMessage response = await client.GetAsync(url);

There is StatusCode property in response object, you can analyze this property whether you get OK or PartialContent. You can also watch the following links for further details: http://social.msdn.microsoft.com/Forums/en/winappswithcsharp/thread/f27c385a-e783-4062-a0b8-e21bf1704f95

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh781241.aspx

Upvotes: 1

Related Questions