Esempio n. 1
0
        /// <summary>
        /// Gets the selected file exporter.
        /// </summary>
        /// <returns>The file exporter.</returns>
        private IBooksFileExport GetSelectedFileExporter()
        {
            Type             exporterType = SelectedExportType.GetGeneratorClass();
            object           instance     = Activator.CreateInstance(exporterType);
            IBooksFileExport exporter     = (IBooksFileExport)instance;

            return(exporter);
        }
Esempio n. 2
0
        /// <summary>
        /// The export file command action.
        /// </summary>
        private void ExportFileCommandAction()
        {
            // Get the exporter.
            IBooksFileExport exporter = GetSelectedFileExporter();

            // Get the data.
            if (BooksReadProvider != null)
            {
                string error;
                ExportErrorMessage =
                    !exporter.WriteToFile(OutputFile, GeographyProvider, BooksReadProvider, out error) ? error : string.Empty;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// The select output file command action.
        /// </summary>
        private void SelectOutputFileCommandAction()
        {
            // Get the exporter.
            IBooksFileExport exporter = GetSelectedFileExporter();

            // Set up the save file dialog.
            SaveFileDialog fileDialog = new SaveFileDialog
            {
                Filter           = exporter.Filter,
                FilterIndex      = 4,
                RestoreDirectory = true
            };

            // If exporting set the output file.
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                OutputFile = fileDialog.FileName;
            }
        }