Beispiel #1
0
        private void CaptureCurrentScreen()
        {
            Task.Run(async() =>
            {
                await Task.Delay(500);

                _screenshot      = _machineContext.CaptureCurrentScreen();
                var bitmapSource = _imageService.GetBitmapSource(_screenshot);
                bitmapSource.Freeze();

                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    WindowVisibility = Visibility.Visible;
                    CapturedImage    = bitmapSource;
                    IsLoading        = false;
                });

                var ocrResult = await _OCRService.GetText(SelectedOCRLanguage, _screenshot);

                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    OCRResult    = ocrResult;
                    IsOCRLoading = false;
                });
            });

            WindowVisibility = Visibility.Hidden;
        }