RhSolutions-AddIn/RhSolutions.AddIn/Tools/ProgressBar.cs
2023-06-20 07:25:44 +03:00

29 lines
643 B
C#

#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
public class ProgressBar : StatusbarBase
{
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;
Excel.StatusBar = $"{Message} Выполнено {percent:#.#} %";
}
}