AdvancedLauncher.UI.Controls.NewsBlock.GetImage C# (CSharp) Method

GetImage() private method

private GetImage ( string url ) : BitmapImage
url string
return System.Windows.Media.Imaging.BitmapImage
        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;
            }
        }