public ExportMultipleDialogView(IConversationManager conversationManager, IDisplayOptionsReadOnly displayOptions) { InitializeComponent(); IFileSystem exportFileSystem = new OsFileSystem(); ExportErrorFormatter exportErrorFormatter = new ExportErrorFormatter(); _model = new ExportMultipleDialogModel(conversationManager, displayOptions, exportFileSystem, exportErrorFormatter); _progressCallback = null; Loaded += delegate { folderPathTextBox.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); }; }
private void ExportCurrentConversation() { ExportedFilenameGenerator filenameGenerator = new ExportedFilenameGenerator(); SaveFileDialog saveDialog = new SaveFileDialog(); const int FilterIndexHtml = 1; const int FilterIndexPlaintext = 2; saveDialog.Filter = "Web Page|*.html|Text File|*.txt"; saveDialog.Title = "Save Conversation History As"; saveDialog.AddExtension = true; saveDialog.FileName = filenameGenerator.CreateExportFilenameSuggestion(_mainWindowModel.SelectedConversation); saveDialog.ShowDialog(); if (string.IsNullOrEmpty(saveDialog.FileName)) { return; } IFileSystem exportFileSystem = new OsFileSystem(); IConversationExporter conversationExporter; switch (saveDialog.FilterIndex) { case FilterIndexHtml: conversationExporter = new ConversationExporterHtml(exportFileSystem); break; case FilterIndexPlaintext: conversationExporter = new ConversationExporterPlaintext(exportFileSystem); break; default: throw new ArgumentException("Invalid file save type."); } conversationExporter.Export(_mainWindowModel.SelectedConversation, _displayOptions, saveDialog.FileName); }