2023-08-24 22:28:37 -04:00
|
|
|
|
using Avalonia.Data.Converters;
|
|
|
|
|
using SPTInstaller.CustomControls;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
|
|
|
|
namespace SPTInstaller.Converters;
|
2024-05-01 10:31:55 -04:00
|
|
|
|
|
2023-08-24 22:28:37 -04:00
|
|
|
|
public class StatusSpinnerIsProcessingConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not StatusSpinner.SpinnerState state)
|
|
|
|
|
return null;
|
2024-05-01 10:31:55 -04:00
|
|
|
|
|
|
|
|
|
|
2023-08-24 22:28:37 -04:00
|
|
|
|
if (parameter is string parm && parm == "invert")
|
|
|
|
|
{
|
|
|
|
|
return state > 0;
|
|
|
|
|
}
|
2024-05-01 10:31:55 -04:00
|
|
|
|
|
2023-08-24 22:28:37 -04:00
|
|
|
|
return state <= 0;
|
|
|
|
|
}
|
2024-05-01 10:31:55 -04:00
|
|
|
|
|
2023-08-24 22:28:37 -04:00
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
return value;
|
|
|
|
|
}
|
2024-05-01 10:31:55 -04:00
|
|
|
|
}
|