SPT-AKI-Installer/SPTInstaller/Converters/InvertedProgressConverter.cs

27 lines
629 B
C#
Raw Permalink Normal View History

using System.Globalization;
using Avalonia.Data.Converters;
2023-05-11 23:11:39 -04:00
namespace SPTInstaller.Converters;
public class InvertedProgressConverter : IValueConverter
2023-05-11 23:11:39 -04:00
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
2023-05-11 23:11:39 -04:00
{
if (value is int progress)
2023-05-11 23:11:39 -04:00
{
return 100 - progress;
2023-05-11 23:11:39 -04:00
}
return value;
}
2023-05-11 23:11:39 -04:00
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is int invertedProgress)
{
return 100 - invertedProgress;
2023-05-11 23:11:39 -04:00
}
return value;
2023-05-11 23:11:39 -04:00
}
}