首次提交:添加src文件夹代码
This commit is contained in:
30
Cowain.Bake.Common/Converter/StationTypeConverter.cs
Normal file
30
Cowain.Bake.Common/Converter/StationTypeConverter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user