2024-09-09 20:22:12 -07:00
|
|
|
|
using Avalonia;
|
2024-09-09 03:26:43 -07:00
|
|
|
|
using Avalonia.Controls;
|
2024-07-06 02:17:41 -07:00
|
|
|
|
using Avalonia.Data.Converters;
|
2024-09-09 03:26:43 -07:00
|
|
|
|
using Avalonia.Media;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Converters
|
|
|
|
|
{
|
|
|
|
|
public static class IntConverters
|
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsGreaterThanZero =
|
2024-02-05 23:08:37 -08:00
|
|
|
|
new FuncValueConverter<int, bool>(v => v > 0);
|
|
|
|
|
|
2024-05-26 19:29:15 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsGreaterThanFour =
|
|
|
|
|
new FuncValueConverter<int, bool>(v => v > 4);
|
|
|
|
|
|
2024-03-31 01:54:29 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsZero =
|
2024-02-05 23:08:37 -08:00
|
|
|
|
new FuncValueConverter<int, bool>(v => v == 0);
|
|
|
|
|
|
2024-03-31 01:54:29 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsOne =
|
2024-02-17 23:44:05 -08:00
|
|
|
|
new FuncValueConverter<int, bool>(v => v == 1);
|
2024-04-01 04:59:15 -07:00
|
|
|
|
|
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsNotOne =
|
|
|
|
|
new FuncValueConverter<int, bool>(v => v != 1);
|
2024-06-23 00:45:54 -07:00
|
|
|
|
|
2024-06-23 06:35:28 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsSubjectLengthBad =
|
2024-06-23 00:45:54 -07:00
|
|
|
|
new FuncValueConverter<int, bool>(v => v > ViewModels.Preference.Instance.SubjectGuideLength);
|
2024-07-09 21:11:51 -07:00
|
|
|
|
|
2024-06-23 06:35:28 -07:00
|
|
|
|
public static readonly FuncValueConverter<int, bool> IsSubjectLengthGood =
|
|
|
|
|
new FuncValueConverter<int, bool>(v => v <= ViewModels.Preference.Instance.SubjectGuideLength);
|
2024-07-06 02:17:41 -07:00
|
|
|
|
|
|
|
|
|
public static readonly FuncValueConverter<int, Thickness> ToTreeMargin =
|
|
|
|
|
new FuncValueConverter<int, Thickness>(v => new Thickness(v * 16, 0, 0, 0));
|
2024-09-09 03:26:43 -07:00
|
|
|
|
|
|
|
|
|
public static readonly FuncValueConverter<int, IBrush> ToBookmarkBrush =
|
|
|
|
|
new FuncValueConverter<int, IBrush>(bookmark =>
|
|
|
|
|
{
|
|
|
|
|
if (bookmark == 0)
|
|
|
|
|
return Application.Current?.FindResource("Brush.FG1") as IBrush;
|
|
|
|
|
else
|
|
|
|
|
return Models.Bookmarks.Brushes[bookmark];
|
|
|
|
|
});
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
|
}
|