You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Khd.Core.Wpf.myConverter
{
[ValueConversion(typeof(int), typeof(string))]
public class AgvTaskStatusConverter : IValueConverter
{
Dictionary<int,string> dic=new Dictionary<int, string>()
{
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"任务开始" },
{3,"已到起始地" },
{4,"起始地继续任务" },
{5,"已到目的地" },
{6,"任务结束" },
};
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int val = System.Convert.ToInt32(value);
if(dic.TryGetValue(val, out string result))
{
return result;
}
else
{
return value;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}