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

27 lines
774 B
C#
Raw Normal View History

using Avalonia.Data.Converters;
using SPTInstaller.CustomControls;
using System.Globalization;
namespace SPTInstaller.Converters;
2024-05-01 10:31:55 -04:00
public class StatusSpinnerIsStateConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
2024-05-01 10:31:55 -04:00
if (value == null || parameter == null)
return null;
2024-05-01 10:31:55 -04:00
if (value is not StatusSpinner.SpinnerState state)
return null;
2024-05-01 10:31:55 -04:00
if (parameter is not string stateName)
return null;
2024-05-01 10:31:55 -04:00
return state.ToString().ToLower() == stateName.ToLower();
}
2024-05-01 10:31:55 -04:00
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value;
}
2024-05-01 10:31:55 -04:00
}