private void ExportConversationsAsync()
        {
            ExportedFilenameGenerator filenameGenerator = new ExportedFilenameGenerator();
            string folderName = filenameGenerator.CreateExportFolderNameSuggestion();

            string outputPath = System.IO.Path.Combine(folderPathTextBox.Text, folderName);

            BackgroundWorker backgroundWorker = new BackgroundWorker();

            _progressCallback = new ProgressCallback(backgroundWorker);

            backgroundWorker.WorkerReportsProgress      = true;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork             += OnDoWork;
            backgroundWorker.ProgressChanged    += OnProgressChanged;
            backgroundWorker.RunWorkerCompleted += OnWorkerCompleted;

            ExportMultipleDialogModel.ExportFormat exportFormat = GetExportFormat();

            AsyncExportingProgressParams exportingParams = new AsyncExportingProgressParams(_progressCallback, _model, exportFormat, outputPath);

            SetUiToExportInProgress();

            backgroundWorker.RunWorkerAsync(exportingParams);
        }
        private static void OnDoWork(object sender, DoWorkEventArgs e)
        {
            AsyncExportingProgressParams exportingParams = (AsyncExportingProgressParams)e.Argument;

            ExportMultipleDialogModel model = exportingParams.Model;

            ExportMultipleDialogModel.ExportFormat exportFormat = exportingParams.ExportFormat;
            string            exportPath       = exportingParams.ExportPath;
            IProgressCallback progressCallback = exportingParams.ProgressCallback;

            try
            {
                progressCallback.Begin(model.ConversationCount);

                model.ExportConversations(exportFormat, exportPath, progressCallback);

                progressCallback.End();
            }
            catch (OperationCanceledException)
            {
                e.Cancel = true;
            }
        }
        private void ExportConversationsAsync()
        {
            ExportedFilenameGenerator filenameGenerator = new ExportedFilenameGenerator();
            string folderName = filenameGenerator.CreateExportFolderNameSuggestion();

            string outputPath = System.IO.Path.Combine(folderPathTextBox.Text, folderName);

            BackgroundWorker backgroundWorker = new BackgroundWorker();
            _progressCallback = new ProgressCallback(backgroundWorker);

            backgroundWorker.WorkerReportsProgress = true;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork += OnDoWork;
            backgroundWorker.ProgressChanged += OnProgressChanged;
            backgroundWorker.RunWorkerCompleted += OnWorkerCompleted;

            ExportMultipleDialogModel.ExportFormat exportFormat = GetExportFormat();

            AsyncExportingProgressParams exportingParams = new AsyncExportingProgressParams(_progressCallback, _model, exportFormat, outputPath);

            SetUiToExportInProgress();

            backgroundWorker.RunWorkerAsync(exportingParams);
        }