Esempio n. 1
0
        async void RunTheWorkerThread()
        {
            Task <ImageProcessingResults> imageProcessingTask = GetJobAndProcessIt();

            while (true)
            {
                ImageProcessingResults processingResults = await(imageProcessingTask);
                imageProcessingTask = GetJobAndProcessIt();
                BitmapSource bitmapSource = ImageProcessingFunctions.CreateBitmap(processingResults);
                this.DisplayImage = bitmapSource;
            }
        }
Esempio n. 2
0
        async Task <ImageProcessingResults> GetJobAndProcessIt()
        {
            if (!_panelId.HasValue)
            {
                _panelId = this._processingTaskMonitor.OpenPanel();
            }
            var processingResults = await Task.Run(() =>
            {
                this._processingTaskMonitor.SetPanelText(_panelId.Value, "Waiting for processing job");
                var processingJob = this._imageProcessingWorkDispatcher.GetJob();
                this._processingTaskMonitor.SetPanelText(_panelId.Value, "Performing processing job");
                return(ImageProcessingFunctions.Process(processingJob));
            });

            return(processingResults);
        }