RhSolutions-AddIn/RhSolutions.AddIn/Tools/ProgressBar.cs

29 lines
643 B
C#
Raw Permalink Normal View History

2023-04-06 08:29:39 +03:00
#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
2023-06-20 07:25:44 +03:00
public class ProgressBar : StatusbarBase
2023-04-06 08:29:39 +03:00
{
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:#.#} %";
}
}