aboutsummaryrefslogtreecommitdiff
path: root/src/Interface/ProgressBar.cs
blob: 37f8559c7ab0ec7cd004492056ad342438792ad3 (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
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:#.#} %";
            }
        }
    }
}