31 lines
834 B
C#
31 lines
834 B
C#
using Cowain.Bake.Common.Enums;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace Cowain.Bake.Common.Converter
|
|
{
|
|
public class BatteryStatusConvertor : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value == null)
|
|
{
|
|
return null;
|
|
}
|
|
value = System.Convert.ToInt32(value);
|
|
EBatteryStatus status = (EBatteryStatus)value;
|
|
return status.FetchDescription();
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|