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

50 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Text;
#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
public 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();
}
}