40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using Work.ERP.API;
|
|
using TaskStatus = Work.ERP.API.TaskStatus;
|
|
|
|
namespace _29WxOrderWpf.Converters
|
|
{
|
|
/// <summary>
|
|
/// 订单任务状态转换:<see cref="Work.KJDServer.API.Models.TaskItem.Status"/> (int) → 中文描述。
|
|
/// 1=执行中,2=已完成,3=已人为中断。
|
|
/// </summary>
|
|
public class OrderTaskStatusConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is int status)
|
|
{
|
|
switch ((TaskStatus)status)
|
|
{
|
|
case TaskStatus.Executing:
|
|
return "执行中";
|
|
case TaskStatus.Completed:
|
|
return "已完成";
|
|
case TaskStatus.ManuallyInterrupted:
|
|
return "已中断";
|
|
case TaskStatus.Fail:
|
|
return "执行失败";
|
|
}
|
|
}
|
|
return value?.ToString() ?? string.Empty;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
}
|