aboutsummaryrefslogtreecommitdiff
path: root/src/Interface
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2022-02-02 10:23:50 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2022-02-02 10:23:50 +0300
commit120eee0231d02e90d9d195ebc38327a58d4564a8 (patch)
treeed1819297d8825805dbeb15156a032b172e826b9 /src/Interface
parent06799119fb83cb6b75721c5cf60f4051e50976a7 (diff)
Add Excel statusbar progress message
Diffstat (limited to 'src/Interface')
-rw-r--r--src/Interface/ProgressBar.cs32
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;
+ }
+ }
+ }
+}