using Avalonia.Data.Converters; using Avalonia.Media; using System; using System.Globalization; namespace YZWater.Avalonia.Converters; /// /// 布尔值转换器集合 /// public static class BoolConverters { /// /// true → #00897B (Success绿), false → #6B7280 (灰色) /// public static readonly IValueConverter ToBrush = new FuncValueConverter(active => active ? new SolidColorBrush(Color.Parse("#00897B")) : new SolidColorBrush(Color.Parse("#6B7280"))); /// /// true → Bold, false → Normal /// public static readonly IValueConverter ToFontWeight = new FuncValueConverter(active => active ? FontWeight.Bold : FontWeight.Normal); /// /// true → Disable, false → Enable (localized) /// public static readonly IValueConverter ToActiveText = new FuncValueConverter(active => active ? YZWater.Core.Services.LanguageService.Instance.Get("Disable") : YZWater.Core.Services.LanguageService.Instance.Get("Enable")); /// /// true → "ON", false → "OFF" /// public static readonly IValueConverter ToText = new FuncValueConverter(active => active ? "ON" : "OFF"); /// /// true → "中控", false → "屏控" /// public static readonly IValueConverter ToModeText = new FuncValueConverter(active => active ? "中控" : "屏控"); }