private BitmapImage GetImage(string url)
{
using (WebClient wc = new WebClientEx()) {
Uri uri = new Uri(url);
byte[] image_bytes;
try {
image_bytes = wc.DownloadData(uri);
} catch {
return null;
}
MemoryStream img_stream = new MemoryStream(image_bytes, 0, image_bytes.Length);
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = img_stream;
bitmap.EndInit();
bitmap.Freeze();
return bitmap;
}
}