RhSolutions-AddIn/src/Interface/ProgressBar.cs

27 lines
675 B
C#
Raw Normal View History

2022-02-04 09:17:12 +03:00
namespace RehauSku.Interface
2022-02-02 10:23:50 +03:00
{
2022-02-04 09:17:12 +03:00
internal class ProgressBar : AbstractBar
2022-02-02 10:23:50 +03:00
{
private double CurrentProgress { get; set; }
private readonly double TaskWeight;
2022-02-03 21:56:14 +03:00
private readonly string Message;
2022-02-02 10:23:50 +03:00
2022-02-03 21:56:14 +03:00
public ProgressBar(string message, int weight)
2022-02-02 10:23:50 +03:00
{
2022-02-03 21:56:14 +03:00
Message = message;
2022-02-02 10:23:50 +03:00
TaskWeight = weight;
CurrentProgress = 0;
}
2022-02-04 09:17:12 +03:00
public override void Update()
2022-02-02 10:23:50 +03:00
{
double percent = (++CurrentProgress / TaskWeight) * 100;
if (percent < 100)
{
2022-02-12 16:53:34 +03:00
Excel.StatusBar = $"{Message} Выполнено {percent:#.#} %";
2022-02-02 10:23:50 +03:00
}
}
}
}