System.Windows.Forms.PictureBox.ImageDownload_DownloadDataCompleted C# (CSharp) Method

ImageDownload_DownloadDataCompleted() private method

private ImageDownload_DownloadDataCompleted ( object sender, DownloadDataCompletedEventArgs e ) : void
sender object
e DownloadDataCompletedEventArgs
return void
		void ImageDownload_DownloadDataCompleted (object sender, DownloadDataCompletedEventArgs e)
		{
			if (e.Error != null && !e.Cancelled)
				Image = error_image;
			else if (e.Error == null && !e.Cancelled)
				using (MemoryStream ms = new MemoryStream (e.Result))
					Image = Image.FromStream (ms);
					
			ImageDownload.DownloadProgressChanged -= new DownloadProgressChangedEventHandler (ImageDownload_DownloadProgressChanged);
			ImageDownload.DownloadDataCompleted -= new DownloadDataCompletedEventHandler (ImageDownload_DownloadDataCompleted);
			image_download = null;
			
			OnLoadCompleted (e);
		}