Пример #1
0
        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);
            }
        }
Пример #2
0
 public static void ExportData(string defaultFileName, string dataTypeName, DataExchangeSet exportData)
 {
     ExportData <object> (defaultFileName, dataTypeName, exportData);
 }