0

I have an app where the user can choose to download all content and this was done with this method on other platforms

 resp.GetResponseStream().BeginRead(mBuffer, 0, 1448, new AsyncCallback(EndRead), resp);

but a BeginRead-method is not present in the .NET framework used by UWP applications. I need a way to do this in the same way as the other platforms do it, so I can use the callback-function for progressbar updating.

Any ideas?

Romasz
  • 29,662
  • 13
  • 79
  • 154
stonecompass
  • 547
  • 9
  • 27

1 Answers1

1

I need a way to do this in the same way as the other platforms do it, so I can use the callback-function for progressbar updating.

You can use this way as a workaround:

        var request = WebRequest.CreateHttp("http://www.bing.com");

        var response = await request.GetResponseAsync();

        byte[] buffer = new byte[1024];

        var stream = await response.GetResponseStream().ReadAsync(buffer, 0, 1024);

        // add callback actions here
Jeffrey Chen
  • 4,650
  • 1
  • 18
  • 22