using Avalonia; using Avalonia.Controls; using Avalonia.Data.Converters; using Avalonia.Media; namespace SourceGit.Converters { public static class IntConverters { public static readonly FuncValueConverter IsGreaterThanZero = new FuncValueConverter(v => v > 0); public static readonly FuncValueConverter IsGreaterThanFour = new FuncValueConverter(v => v > 4); public static readonly FuncValueConverter IsZero = new FuncValueConverter(v => v == 0); public static readonly FuncValueConverter IsOne = new FuncValueConverter(v => v == 1); public static readonly FuncValueConverter IsNotOne = new FuncValueConverter(v => v != 1); public static readonly FuncValueConverter IsSubjectLengthBad = new FuncValueConverter(v => v > ViewModels.Preference.Instance.SubjectGuideLength); public static readonly FuncValueConverter IsSubjectLengthGood = new FuncValueConverter(v => v <= ViewModels.Preference.Instance.SubjectGuideLength); public static readonly FuncValueConverter ToTreeMargin = new FuncValueConverter(v => new Thickness(v * 16, 0, 0, 0)); public static readonly FuncValueConverter ToBookmarkBrush = new FuncValueConverter(bookmark => { if (bookmark == 0) return Application.Current?.FindResource("Brush.FG1") as IBrush; else return Models.Bookmarks.Brushes[bookmark]; }); } }