private void GetAcquiredImageAndProcessIt(AsyncProcessingMediator mediator)
        {
            var image = mediator.GetAcquiredImageAndSetImageProcessedStatus();

            try
            {
                var processedImage = _imageProcessingChain.ProcessImage(image);
                _setOutputImageCommand.Execute(processedImage);
            }
            finally
            {
                mediator.SetImageProcessingStatus(ImageProcessingStatus.NoImageProcessed);
            }
        }
        private void AcquireImageWork()
        {
            while (!_cancellationTokenSource.IsCancellationRequested)
            {
                Image image;
                if (!_imageProvider.TryToObtainImage(out image))
                {
                    break;
                }

                SetAcquiredImage(_mediator, image);

                Thread.SpinWait(1);
            }

            _mediator.SetImageProcessingStatus(ImageProcessingStatus.ImageProviderStopped);
        }