コード例 #1
0
        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);
            };
        }
コード例 #2
0
        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);
            };
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }