code_style: remove unused converters

This commit is contained in:
leo 2024-09-10 11:22:12 +08:00
parent 853d5ce20e
commit 33e4404222
No known key found for this signature in database

View file

@ -1,9 +1,5 @@
using System; using Avalonia;
using System.Globalization;
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Data.Converters; using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
@ -43,28 +39,5 @@ namespace SourceGit.Converters
else else
return Models.Bookmarks.Brushes[bookmark]; return Models.Bookmarks.Brushes[bookmark];
}); });
public class ToColorHexStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Color.FromUInt32((uint)value).ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
var color = Color.Parse(value as string);
return color.ToUInt32();
}
catch
{
return BindingOperations.DoNothing;
}
}
}
public static readonly ToColorHexStringConverter ToColorHexString = new ToColorHexStringConverter();
} }
} }