public virtual FlowDocument Convert(XPathDocument document, Story story) { if (document == null) { throw new ArgumentNullException("document"); } //if(something in the doc signifies that this is an MSDN Magazine article) MsdnMagazineDocumentToFlowDocumentConverter magazineConverter = new MsdnMagazineDocumentToFlowDocumentConverter(); return(magazineConverter.Convert(document, story)); //else use the other converter (ie MsdnLibraryDocumentToFlowDocumentConverter) //XPathNavigator navigator = document.CreateNavigator(); //XPathNavigator msdn = GetMsdnNavigator(navigator); //if (msdn == null) //{ // NitfToFlowDocumentConverter conv = new NitfToFlowDocumentConverter(); // return conv.Convert(document, styleProvider); // //throw new InvalidDataException("Root element missing"); //} //return GetFlowDocumentFromNavigator(msdn, null, styleProvider); }
/// <summary> /// Update image viewers, if open with images for the current story /// </summary> private void UpdateImageViewers() { // If current navigator is a story navigator, hook the story's ImageReferenceCollection to the window // if there is an instance of the image viewer window active StoryNavigator storyNavigator = CurrentNavigator as StoryNavigator; if (storyNavigator != null) { Story story = storyNavigator.Content as Story; if (story != null) { if (_imageViewerWindow != null) { _imageViewerWindow.Story = story; if (story.ImageReferenceCollection != null && story.ImageReferenceCollection.Count > 0) { _imageViewerWindow.ImageReference = story.ImageReferenceCollection[0]; } else { _imageViewerWindow.ImageReference = null; } } if (_webFigureViewerWindow != null) { _webFigureViewerWindow.Story = story; _webFigureViewerWindow.Source = MsdnMagazineDocumentToFlowDocumentConverter.GetMagazineArticleWebFigureUri(story); } } } }