This repository has been archived on 2024-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
BetterRaid_OLD/Converters/ChannelOnlineColorConverter.cs

29 lines
791 B
C#

using System;
using System.Globalization;
using Avalonia.Data.Converters;
using Avalonia.Media;
namespace BetterRaid.Converters;
public class ChannelOnlineColorConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is bool isOnline)
{
return isOnline ? new SolidColorBrush(Colors.GreenYellow) : new SolidColorBrush(Colors.OrangeRed);
}
return new SolidColorBrush(Colors.OrangeRed);
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is SolidColorBrush brush)
{
return brush.Color == Colors.GreenYellow;
}
return false;
}
}