aboutsummaryrefslogtreecommitdiff
path: root/src/Interface/ProgressBar.cs
blob: ed889f66768041401848e53afa2ff33a32f28a1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace RehauSku.Interface
{
    internal class ProgressBar : AbstractBar
    {
        private double CurrentProgress { get; set; }
        private readonly double TaskWeight;
        private readonly string Message;

        public ProgressBar(string message, int weight)
        {
            Message = message;
            TaskWeight = weight;
            CurrentProgress = 0;
        }

        public override void Update()
        {
            double percent = (++CurrentProgress / TaskWeight) * 100;

            if (percent < 100)
            {
                Excel.StatusBar = $"{Message} Выполнено {percent.ToString("#.##")} %";
            }

            else
            {
                Excel.StatusBar = false;
            }
        }
    }
}