RhSolutions-AddIn/RhSolutions.AddIn/Tools/ResultBar.cs

50 lines
1.1 KiB
C#
Raw Normal View History

2023-04-06 08:29:39 +03:00
using System.Text;
#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
internal class ResultBar : StatusbarBase
{
private int Success { get; set; }
private int Replaced { get; set; }
private int NotFound { get; set; }
public ResultBar()
{
Success = 0;
Replaced = 0;
NotFound = 0;
}
public void IncrementSuccess() => Success++;
public void IncrementReplaced() => Replaced++;
public void IncrementNotFound() => NotFound++;
public override void Update()
{
StringBuilder sb = new StringBuilder();
if (Success > 0)
{
sb.Append($"Успешно экспортировано {Success} артикулов. ");
}
if (Replaced > 0)
{
sb.Append($"Заменено {Replaced} артикулов. ");
}
if (NotFound > 0)
{
sb.Append($"Не найдено {NotFound} артикулов.");
}
Excel.StatusBar = sb.ToString();
}
}