You are developing a Silverlight 4 application. You plan to host the application in a Web application. The Web application contains a zip file named Images.zip that contains an image named logo.jpg. You write the following code segment.
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(ClientOpenReadCompleted);
client.OpenReadAsync(new Uri(@”..\Images.zip”,UriKind.Relative));
You also write the following event handler. (Line numbers are included for reference only.)
01 void client_OpenReadCompleted(object sender,
02 OpenReadCompletedEventArgs e)
03 {
04 if (e.Error == null && !e.Cancelled)
05 {
06
07 }
08 }
The main window contains an Image element named ImgLogo. You need to extract logo.jpg from Images.zip and set logo.jpg as the source for ImgLogo. Which code segment should you insert at line 06?
A.
var zipResource = new StreamResourceInfo(e.Result, @”application/zip”);
var imageSource = Application.GetResourceStream(zipResource, new Uri(“Logo.jpg”,UriKind.Absolute));
BitmapImage image = new BitmapImage(); image.SetSource(imageSource.Stream);
ImgLogo.Source=image;
B.
var zipResource = new StreamResourceInfo(e.Result, @”application/zip”);
var imageSource = Application.GetResourceStream(zipResource, new Uri(“Logo.jpg”, UriKind. Relative));
BitmapImage image = new BitmapImage(); image.SetSource(imageSource.Stream);
ImgLogo.Source=image;
C.
var imageSource = new StreamResourceInfo(e.Result, “./Logo.jpg”);
BitmapImage image = new BitmapImage(); image.SetSource(imageSource.Stream);
ImgLogo.Source = image;
D.
var imageSource = new StreamResourceInfo(e.Result, “Images/Logo.jpg”);
BitmapImage image = new BitmapImage(); image.SetSource(imageSource.Stream);
ImgLogo.Source = image;