public void Run() { if (IsDisposed) { return; } LastStatus = JobStatus.Running; try { Job.Run(); LastStatus = JobStatus.Done; } catch (OperationCanceledException e) { if (!IsDisposed && e.CancellationToken == Cts.Token) { LastStatus = JobStatus.Canceled; JobChange?.Invoke(this, JobChangeEvent.Canceled); } } catch (FileOperationException e) { LastStatus = JobStatus.Error; Exception = e; JobChange?.Invoke(this, JobChangeEvent.ExceptionThrown); } }
private void OnJobProgressChange(float progress) { Progress = progress; if (Progress - lastProgressReported > 0.1) { JobChange?.Invoke(this, JobChangeEvent.OnProgressChange); lastProgressReported = Progress; } }
private static void OnJobChange(IJobView changedJob, JobChangeEvent changeEvent) { JobChange?.Invoke(changedJob, changeEvent); }