private async Task JobProgressTask(ForgeObjectInfo item, IProgress <ProgressInfo> progress, CancellationToken ct, TaskScheduler uiScheduler) { progress.Report(new ProgressInfo(0, "Initializing...")); while (!ct.IsCancellationRequested) { try { ProgressInfo info = await JobProgressRequest(item); if (info == null) { progress.Report(new ProgressInfo(0, "Error")); break; } progress.Report(info); if (info.pct >= 100 || info.msg == "success") { item.TranslationRequested = StateEnum.Busy; if (_callback != null) { this.Dispatcher.Invoke(_callback, new Object [] { item }); } break; } } catch (Exception /*ex*/) { } } }
private void ReportProgress(ProgressInfo value) { progressBar.Value = value.pct; progressMsg.Content = value.msg; }
public void ReportProgress(ProgressInfo value) { progressBar.Value = value.pct; progressMsg.Content = value.msg; progressBar.IsIndeterminate = (value.pct != 0 && value.pct != 100); }