Feature request: Set progress by percentage
KoalaBear84 opened this issue · 2 comments
KoalaBear84 commented
I would like to set the progress by percentage.
Something like this:
// Set progress to 10.7%
ProgressBar.SetPercentage(10.7);
// or
ProgressBar.SetPercentage(10.7m);
Currently using hardcoded 1000 ticks and:
ProgressBar.Tick((int)(progress / 0.1m));
Also would be nice to support a single digits after the comma separator, so it will display "10.7%" instead of "10.70%". Also because it's faster to read, and not as
Thanks!
0xced commented
You can already achieve this by using AsProgress<float>()
which returns an IProgress<float>
that you can use to report progression as percentage:
using var progressBar = new ProgressBar(10000, "My Progress Message");
var progress = progressBar.AsProgress<float>();
progress.Report(0.107); // 10.7%
KoalaBear84 commented
Thanks, if this could be added to the readme it would be nice.