RhSolutions-AddIn/src/Interface/ProgressBar.cs

33 lines
746 B
C#
Raw Normal View History

2022-02-02 10:23:50 +03:00
using Microsoft.Office.Interop.Excel;
namespace RehauSku.Interface
{
internal class ProgressBar
{
private Application Excel = AddIn.Excel;
private double CurrentProgress { get; set; }
private readonly double TaskWeight;
public ProgressBar(int weight)
{
TaskWeight = weight;
CurrentProgress = 0;
}
public void DoProgress()
{
double percent = (++CurrentProgress / TaskWeight) * 100;
if (percent < 100)
{
Excel.StatusBar = $"Выполнено {percent.ToString("#.##")} %";
}
else
{
Excel.StatusBar = false;
}
}
}
}