public ActionResult Scan(ScanForm command, IScannerManager scannerManager) { var scanResult = new ScanCommand(command, scannerManager).Execute(_markerAsync); if (scanResult.Validate()) return new ActionResult { Content = scanResult.Content, ContentType = "text/json" }; throw new Exception(scanResult.Error); }
public ScanForm BindScanForm() { var command = new ScanForm { FileName = TryGet("Form.FileName"), FileCounter = TryGet("Form.FileCounter"), CompressionFormat = new CompressionFormat(TryGet("Form.CompressionFormat")), ColorMode = TryGetInt("Form.ColorMode", 0), DPI = TryGetFloat("Form.Dpi", 150f), Source = TryGetInt("Form.Source", 0), IsPackage = TryGet("isPackage"), SaveAs = TryGetInt("Form.SaveAs", 0), Format = new FormatPage(TryGet("Form.Format")), DocumentHandlingCap = TryGetNullableInt("Form.ScanFeed", null) }; return command; }
public ScanCommand(ScanForm command, IScannerManager scannerManager) { _command = command; _scannerManager = scannerManager; _log = LogManager.GetLogger(typeof (ScanCommand)); }