using System; using System.Globalization; using System.Windows; using MmdPdf.Controls; using MmdPdf.Features.Scan; namespace MmdPdf { // Pulling pages off a copier. The dialog does the talking to the hardware; this file only // turns the pages it hands back into a document, which is the same route an imported // photograph takes (ImportAndZip.cs). public partial class MainWindow { private void Scan_Click(object sender, RoutedEventArgs e) { var dlg = new ScanDialog { Owner = this }; bool? answer; try { answer = dlg.ShowDialog(); } catch (Exception ex) { KillerDialog.Show(this, "The copier could not be reached.\n" + ex.Message, "MMD PDF", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (answer != true || dlg.Pages.Length == 0) return; string name = "Scan " + DateTime.Now.ToString("d MMM yyyy HH:mm", CultureInfo.CurrentCulture); OpenImagesAsImportedTab(dlg.Pages, name); // "Make the words searchable" is the copier setting a person ticks before the run; // the reading itself happens here, on the document that just opened, through the // text recognition the application already carries. if (dlg.MakeSearchable) MakeSearchablePdf(); } } }