/// <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); }
/// <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; } }
/// <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; } }