In my Windows Store App (c#) I need to upload MultipartFormDataContent
(some strings content and some files) to server and get a huge file at response. The problem - I can't use BackgroundDownloaders
for that. I can only use one request for that.
I use HttpClient.PostAsync
method:
using (var client = new HttpClient(httpClientHandler))
{
using (var content = new MultipartFormDataContent())
{
content.Add(...); // prepare all strings and files content
try
{
using (var response = await client.PostAsync(url, content))
{
if (response.StatusCode == HttpStatusCode.OK)
{
var inputBytes = await response.Content.ReadAsByteArrayAsync();
// some operations with inputBytes
}
......
}
}
}
}
My question is: How can I calculate progress of this operation?
Note: My target - Windows 8. And I can't use Windows.Web.Http.HttpClient
(Minimum supported client Windows 8.1). Only System.Net.Http.HttpClient