public Task RunTransferJob(TransferJobBase job, Action<double, double> progressReport, CancellationToken cancellationToken) { try { return runnerValidation(job); } catch (AssertFailedException e) { this.assertException = e; throw new MockupException("AssertFailed"); } }
public Task RunTransferJob(TransferJobBase job, Action <double, double> progressReport, CancellationToken cancellationToken) { try { return(runnerValidation(job)); } catch (AssertFailedException e) { this.assertException = e; throw new MockupException("AssertFailed"); } }
public Task RunTransferJob(TransferJobBase job, Action <double, double> progressReport, CancellationToken cancellationToken) { TaskCompletionSource <object> downloadCompletionSource = new TaskCompletionSource <object>(); job.StartEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } progressReport(0, 0); }; job.ProgressEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } progressReport(eventArgs.Progress, eventArgs.Speed); }; job.FinishEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } if (eventArgs.Exception == null) { downloadCompletionSource.SetResult(null); } else { downloadCompletionSource.SetException(eventArgs.Exception); } }; this.manager.EnqueueJob(job, cancellationToken); return(downloadCompletionSource.Task); }
public Task RunTransferJob(TransferJobBase job, Action<double, double> progressReport, CancellationToken cancellationToken) { TaskCompletionSource<object> downloadCompletionSource = new TaskCompletionSource<object>(); job.StartEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } progressReport(0, 0); }; job.ProgressEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } progressReport(eventArgs.Progress, eventArgs.Speed); }; job.FinishEvent += (sender, eventArgs) => { if (cancellationToken.IsCancellationRequested) { return; } if (eventArgs.Exception == null) { downloadCompletionSource.SetResult(null); } else { downloadCompletionSource.SetException(eventArgs.Exception); } }; this.manager.EnqueueJob(job, cancellationToken); return downloadCompletionSource.Task; }
protected virtual void AppendEventHandlers(TransferJobBase transferJob, DataMovementUserData userData) { transferJob.StartEvent += (eventSource, eventArgs) => { this.OnDMJobStart(userData); }; transferJob.ProgressEvent += (eventSource, eventArgs) => { this.OnDMJobProgress(userData, eventArgs.Speed, eventArgs.Progress); }; transferJob.FinishEvent += (eventSource, eventArgs) => { this.OnDMJobFinish(userData, eventArgs.Exception); }; }