Files
6098/Cowain.Bake.Common/Converter/StationTypeConverter.cs

31 lines
857 B
C#
Raw Permalink Normal View History


using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
using Cowain.Bake.Common.Enums;
using Prism.Ioc;
namespace Cowain.Bake.Common.Converter
{
public class StationTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
value = System.Convert.ToInt32(value);
EStationType status = (EStationType)value;
return status.FetchDescription();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
EStationType e = EnumHelper.GetValueByDescription<EStationType>((string)value);
return (int)e;
}
}
}