29 lines
645 B
C#
29 lines
645 B
C#
|
#if !NET472
|
|||
|
using System.Runtime.Versioning;
|
|||
|
#endif
|
|||
|
|
|||
|
namespace RhSolutions.Tools;
|
|||
|
|
|||
|
#if !NET472
|
|||
|
[SupportedOSPlatform("windows")]
|
|||
|
#endif
|
|||
|
internal 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:#.#} %";
|
|||
|
}
|
|||
|
}
|