private void InitWorker() { worker.WorkerReportsProgress = true; worker.DoWork += (o, e) => { Status = ProcessingStages.Processing; var imageProcessor = new ImageProcessor(SourceImage.ToBitmap(), settingsManager); imageProcessor.ProccessImage(worker); e.Result = imageProcessor; }; worker.ProgressChanged += (o, e) => { Progress = e.ProgressPercentage; }; worker.RunWorkerCompleted += (o, e) => { if (e.Error != null) { ShowError(e.Error.Message); Status = ProcessingStages.Error; } else { Status = ProcessingStages.Completed; Progress = 0; var imageProcessor = e.Result as ImageProcessor; cells = imageProcessor.Cells; RaisePropertyChanged(() => Cells); RaisePropertyChanged(() => IsBusy); RaiseCommandsExecute(); } }; }