0

I am using Windows Phone to download a file with a WebClient. The DownloadProgressChanged event does not work. It fires only once, returning a value of "4923206" for DownloadProgressChangedEventArgs.BytesRecieved. My code is:

    private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        WebClient wb = new WebClient();
        wb.DownloadProgressChanged += wbchange;
        wb.OpenReadAsync(new Uri("http://sohowww.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"));
    }

    private void wbchange(object sender, DownloadProgressChangedEventArgs e)
    {
        MessageBox.Show(e.BytesReceived.ToString()); (obviously in the end I will not be showing a message at every change)
    }

What is wrong with this?

msbg
  • 4,852
  • 11
  • 44
  • 73

1 Answers1

0

It's working absolutely fine, it just happens to have downloaded all the bytes on the first DownloadProgressChanged invoke.

If you read the documentation you'll see that this is the expected behaviour.

Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150