Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Showing download percentage using HttpWebRequest and HttpWebResponse in windows, iOS and Android

How do I show percentage of the files that are being downloaded in parallel using HttpWebRequest and HttpWebResponse in Windows, iOS and Android platform?

Answers

  • Patil2421Patil2421 USMember ✭✭✭

    @mainprashant89 You need to use the DownloadProgressChangedEvent for this, which will provide the info about the downloaded data and the total data to be downloaded. Something like this, give a try:

    void WebClient_DownloadProgressChanged (object sender, DownloadProgressChangedEventArgs e)
            {
                App.DownloadProgress = e.ProgressPercentage;
                if (e.TotalBytesToReceive > 0){
                    App.DownloadProgressDetails = "(" + (e.BytesReceived / 1024) + "KB/" + (e.TotalBytesToReceive / 1024) + "KB)";
                }           
    
            }
    

    Convert this data to percentage and you can show this

Sign In or Register to comment.