コード例 #1
0
        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*/) {
                }
            }
        }
コード例 #2
0
 private void ReportProgress(ProgressInfo value)
 {
     progressBar.Value   = value.pct;
     progressMsg.Content = value.msg;
 }
コード例 #3
0
 public void ReportProgress(ProgressInfo value)
 {
     progressBar.Value           = value.pct;
     progressMsg.Content         = value.msg;
     progressBar.IsIndeterminate = (value.pct != 0 && value.pct != 100);
 }