public void ExportWholeStory() { var storyLoader = new XmlStoryFileStore(); var story = storyLoader.DeserializeStory(TestUtil.GetDataFile(@"SampleStories.1824771-short-stories-by-the-people.xml")); var exporter = new WdcStoryExporterHtmlCollection("StoryOutput"); exporter.ExportStory(story); }
/// <summary> /// Open a story, right from the GUI. /// </summary> /// <param name="storyID"></param> private void OpenStoryToRead(string storyID) { // Method 1: export the story to a staging location, and shell execute to open the index homepage. //Get the story if (!_storyContainer.HasStory(storyID)) { MessageBox.Show($"The story '{storyID}' could not be found in the story container."); return; } // TODO: make this a popup GUI with a progress bar // TODO: Make exporter cancellable // TODO: Make exporter have a progress updater, and expose progress event hooks var story = _storyContainer.GetStory(storyID); // Export it var tempDir = Path.Combine(Path.GetTempPath(), "WritingExporter", storyID); Directory.CreateDirectory(tempDir); var exporter = new WdcStoryExporterHtmlCollection(tempDir); var progDialog = new ProgressDialogForm(); exporter.OnProgressUpdate += new EventHandler <WdcStoryExporterProgressUpdateArgs>((sender, args) => { progDialog.UpdateMessage(args.Message); progDialog.UpdateProgress(args.ProgressValue, args.ProgressMax); }); progDialog.Show(this); progDialog.Refresh(); exporter.ExportStory(story); progDialog.CloseForm(); // Open it _guiContext.ShellExecute(Path.Combine(tempDir, exporter.GetHomepageFileName())); }