private async Task ReCapJobProgress(string photosceneid, IProgress <ProgressInfo> progress, CancellationToken ct, TaskScheduler uiScheduler) { progress.Report(new ProgressInfo(0, "Initializing...")); while (!ct.IsCancellationRequested) { //Task<ProgressInfo> task =Task<ProgressInfo>.Factory.StartNew (() => PhotosceneProgress (photosceneid)) ; //await task ; //if ( task.Result == null ) { // progress.Report (new ProgressInfo (0, "Error")) ; // break ; //} //progress.Report (task.Result) ; //if ( task.Result.pct >= 100 ) { // this.Dispatcher.Invoke (_callback, new Object [] { _photosceneid, task.Result.msg }) ; // break ; //} ProgressInfo info = await PhotosceneProgress(photosceneid); //var task =Task.Factory.StartNew ( // async delegate { // ProgressInfo info =await PhotosceneProgress (photosceneid) ; // progress.Report (info) ; // if ( info.pct >= 100 ) { // this.Dispatcher.Invoke (_callback, new Object [] { _photosceneid, info.msg }) ; // } // return (info) ; // }, // CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default //) ; //await task ; if (info == null) { progress.Report(new ProgressInfo(0, "Error")); break; } progress.Report(info); if (info.pct >= 100) { if (_callback != null) { this.Dispatcher.Invoke(_callback, new Object [] { _photosceneid, info.msg }); } break; } } }
private void ReportProgress(ProgressInfo value) { progressBar.Value = value.pct; progressMsg.Content = value.msg; progressBar.IsIndeterminate = (value.pct != 0 && value.pct != 100); }
private void ReportProgress(ProgressInfo value) { progressBar.Value = value.pct; progressMsg.Content = value.msg; }