private void FinishedOne() { OcrOperation op; bool finished = false; lock (this) { op = currentOp; currentOp.Status.CurrentProgress += 1; if (currentOp.Status.CurrentProgress == currentOp.Status.MaxProgress) { currentOp = null; finished = true; } } op.InvokeStatusChanged(); if (finished) { op.InvokeFinished(); } }
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); }