private void worker_DoWork(object sender, DoWorkEventArgs e) { try { var args = (WorkerArgs)e.Argument; using (_exporter = new Code.Exporter(args.UseTransaction, args.DeleteDocuments, args.ReportWarnings, worker)) { e.Result = _exporter.ExportDocuments(args.InputDatabasePath, args.OutputDatabasePath, args.Password); } } catch (Exception ex) { worker.ReportProgress(-1, ex.Message); HandleException(ex); } }
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { _exporter = null; /////////////////////////////////////////////////////////////////////////////// UpdateState(false); /////////////////////////////////////////////////////////////////////////////// if (e.Result is int) { var totalRowsCopied = (int)e.Result; /////////////////////////////////////////////////////////////////////////////// if (!_aborted) { var message = String.Format("{0}{1}{1}Total rows copied: {2}{1}{1}Do you wish to open output database", "Export finished successfully.", Environment.NewLine, totalRowsCopied); if (ShowConfirmationMessage(message)) { OpenDatabaseInAccess(txtOutput.Text); } } else { ShowInfoMessage("Export aborted by user."); } } } catch (Exception ex) { HandleException(ex); } }