PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application will display documents by using an instance of the FlowDocumentPageViewer class. The instance is named fdpv.
Users can highlight and annotate the content of the documents. You need to ensure that annotations made to a document are saved and rendered when the document is displayed again.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
protected void OnTextInput(object sender, RoutedEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service == null)
{
AnnotationStream = new FileStream("annotations.xml", FileMode.Open, FileAccess.ReadWrite);
service = new AnnotationService(fdpv);
AnnotationStore store = new XmlStreamStore(AnnotationStream);
service.Enable(store);
}
}
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service != null && service.IsEnabled )
{
service.Store.Flush();
service.Disable();
AnnotationStream.Close();
}
}

B.
protected void OnLoaded(object sender, RoutedEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service == null)
{
AnnotationStream = new FileStream("annotations.xml", FileMode.Open, FileAccess.ReadWrite);
service = new AnnotationService(fdpv);
}
}
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service != null && service.IsEnabled)
{
service.Store.Flush();
service.Disable();
AnnotationStream.Close();
}
}

C.
protected void OnLoaded(object sender, RoutedEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service == null)
{
AnnotationStream = new FileStream("annotations.xml", FileMode.Open, FileAccess.ReadWrite);
service = new AnnotationService(fdpv);
AnnotationStore store = new XmlStreamStore(AnnotationStream);
service.Enable(store);
}
}
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service != null && service.IsEnabled)
{
service.Store.Flush();
service.Disable();
AnnotationStream.Close();
}
}

D.
protected void OnLoaded(object sender, RoutedEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service == null)
{
AnnotationStream = new FileStream("annotations.xml", FileMode.Open, FileAccess.ReadWrite);
service = new AnnotationService(fdpv);
AnnotationStore store = new XmlStreamStore(AnnotationStream);
service.Enable(store);
}
}
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
AnnotationService service = AnnotationService.GetService(fdpv);
if (service != null && service.IsEnabled)
{
service.Disable();
AnnotationStream.Close();
}
}


Leave a Reply