mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
23 lines
590 B
C#
23 lines
590 B
C#
using Avalonia.Data.Converters;
|
|
using System;
|
|
|
|
namespace Mesen.Localization
|
|
{
|
|
public class EnumConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if(value is Enum && targetType == typeof(string)) {
|
|
return ResourceHelper.GetEnumText((Enum)value);
|
|
}
|
|
|
|
return value?.ToString() ?? "null value";
|
|
}
|
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|