51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Globalization;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using System.Windows.Data;
 | 
						|
 | 
						|
namespace DM_Weight.Converter
 | 
						|
{
 | 
						|
    internal class StockStatusConverter : IValueConverter
 | 
						|
    {
 | 
						|
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            int status = int.Parse(value.ToString());
 | 
						|
            if (parameter.ToString() == "EnableState")
 | 
						|
            {
 | 
						|
                if (status == 1)
 | 
						|
                {
 | 
						|
                    return true;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return false;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            if (parameter.ToString() == "TextState")
 | 
						|
            {
 | 
						|
                if (status == 0)
 | 
						|
                {
 | 
						|
                    return "未取药";
 | 
						|
                }
 | 
						|
                if(status == 1)
 | 
						|
                {
 | 
						|
                    return "已取药待入库";
 | 
						|
                }
 | 
						|
                if(status==2)
 | 
						|
                {
 | 
						|
                    return "正在入库";
 | 
						|
                }
 | 
						|
            }
 | 
						|
            return "";
 | 
						|
        }
 | 
						|
 | 
						|
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            throw new NotImplementedException();
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |