public static void ExportData <T> (string defaultFileName, string dataTypeName, DataExchangeSet exportData) { IDataExporter exporter; string filename; bool? toFile; string email; string subject; using (ExportObjects <T> dialog = new ExportObjects <T> (exportData.Contents, defaultFileName)) { if (dialog.Run() != ResponseType.Ok) { return; } exporter = dialog.Exporter; filename = dialog.FileName; toFile = dialog.ToFile; email = dialog.Email; subject = dialog.EmailSubject; } BusinessDomain.FeedbackProvider.TrackEvent("Export data", dataTypeName); try { exporter.Export(filename, toFile, email, subject, exportData); } catch (LicenseLimitationException ex) { MessageError.ShowDialog(ex.Message, ErrorSeverity.Warning, ex); } catch (IOException ex) { MessageError.ShowDialog(string.Format(Translator.GetString("Error occurred while saving export to \"{0}\". Please check if you have write permissions to that location."), filename), ErrorSeverity.Warning, ex); } catch (Exception ex) { MessageError.ShowDialog(Translator.GetString("Error occurred while performing export."), ErrorSeverity.Warning, ex); } }
private void ExportCommandExecuted(object obj) { Export export = new Export(); ExportObjects objects = new ExportObjects(); Task task = new Task(() => { export.ExportAccounts(objects.GetExportAccountList(SelectedExportRunId), FilePath, objects.GetExportAccountList(SelectedCompareRunId)); MessageBox.Show("Export completed successfully!", "Export to Excel status:"); }); task.Start(); }