How to use `Progress<T>` and not the Ticks?
rpawlaszek opened this issue · comments
Currently to show the progress have to know upfront the maxTicks
and simply increment the ticks. Is there a chance to use ProgressBar
with Progress<T>
?
In principle I'm looking for the capability to use
var progress = new Progress<double>(val => pbar.Percentage = val);
but this property exposes only getter and I can't find any other element that could do such a thing.
Simply set maxTics to 100 and in lambda in Progress just call Tick() with number as parameter.
Thanks @Hooch180, I did something like that, but with multiplying with a magic number, 100. I receive a more fine-grained numbers (as it is Progress<double>
). Effectively, this is the same, but to me it is still a workaround. I have percentage in both cases, but cannot directly use one with the other.
This scenario is addressed in #39 (Add AsProgress<T> method on IProgressBar). If this pull request gets merged, it will become trivial to update an IProgressBar
with an existing IProgress<float>
or IProgress<double>
which reports the percentage completed by simply calling AsProgress<float>()
on the progress bar, see IntegrationWithIProgressPercentageExample:
Closing this as @0xced's PR is now merged.