diff options
Diffstat (limited to 'src/Interface')
-rw-r--r-- | src/Interface/ProgressBar.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Interface/ProgressBar.cs b/src/Interface/ProgressBar.cs new file mode 100644 index 0000000..474bed7 --- /dev/null +++ b/src/Interface/ProgressBar.cs @@ -0,0 +1,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; + } + } + } +} |