protected override async Task ScanInternal(ScannedImageSource.Concrete source) { var op = operationFactory.Create <WiaScanOperation>(); using (CancelToken.Register(op.Cancel)) { op.Start(ScanProfile, ScanDevice, ScanParams, DialogParent, source); Invoker.Current.SafeInvoke(() => { if (ScanParams.Modal && !ScanParams.NoUI) { operationProgress.ShowModalProgress(op); } else { operationProgress.ShowBackgroundProgress(op); } }); await op.Success; } if (op.ScanException != null) { op.ScanException.PreserveStackTrace(); throw op.ScanException; } }
private OcrOperation StartingOne() { OcrOperation op; bool started = false; lock (this) { if (currentOp == null) { currentOp = new OcrOperation(workerTasks); started = true; } op = currentOp; op.Status.MaxProgress += 1; } op.InvokeStatusChanged(); if (started) { operationProgress.ShowBackgroundProgress(op); } return(op); }