aboutsummaryrefslogtreecommitdiff
path: root/src/Interface/ProgressBar.cs
blob: 474bed729188498c3d951d19935b53697db943b3 (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
32
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;
            }
        }
    }
}