I am trying to use webclient check download a stream before it is handled by an ExtendedImage, because my app is showing a bug when the uri is not found.
So my solution is to load the image first and then read the webclient result into the extended image.
This is what I am trying to do.
WebClient wc = new WebClient();
wc.OpenReadAsync(Uri);
wc.OpenReadCompleted += delegate(object Sender, OpenReadCompletedEventArgs e){
Logo = new BitmapImage();
ExtendedImage hExtendedImage = new ExtendedImage();
try
{
hExtendedImage.SetSource(e.Result);
Logo.SetSource(hExtendedImage.ToStream());
}
catch (WebException)
{
}
};
but now I am getting an “image is not loaded” error from hExtendedImage on this line
Logo.SetSource(hExtendedImage.ToStream());
I’m obviously loading the image from e.Result into the hExtendedImage wrong.
1 Answer