86 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Globalization;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Threading.Tasks;
 | 
						|
using System.Windows;
 | 
						|
using System.Windows.Data;
 | 
						|
 | 
						|
namespace DM_Weight.Converter
 | 
						|
{
 | 
						|
    internal class StatusConverter : IValueConverter
 | 
						|
    {
 | 
						|
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            int status = int.Parse(value.ToString());
 | 
						|
            //完成
 | 
						|
            if (parameter.ToString().Equals("CompleteBtn"))
 | 
						|
            {
 | 
						|
                if (status == 3)
 | 
						|
                {
 | 
						|
                    return Visibility.Visible;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return Visibility.Collapsed;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            //关闭
 | 
						|
            if (parameter.ToString().Equals("CloseBtn"))
 | 
						|
            {
 | 
						|
                if (status > 0 && status < 3)
 | 
						|
                {
 | 
						|
                    return false;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return true;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            if (parameter.ToString().Equals("opearBtnLoading"))
 | 
						|
            {
 | 
						|
                if (status > 0 && status < 3)
 | 
						|
                {
 | 
						|
                    return true;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return false;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            //取药
 | 
						|
            if (parameter.ToString().Equals("opearBtnVisible"))
 | 
						|
            {
 | 
						|
                if (status < 3)
 | 
						|
                {
 | 
						|
                    return Visibility.Visible;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return Visibility.Collapsed;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            //取消
 | 
						|
            if (parameter.ToString().Equals("CancelBtn"))
 | 
						|
            {
 | 
						|
                if (status ==3)
 | 
						|
                {
 | 
						|
                    return Visibility.Visible;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    return Visibility.Collapsed;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            return Visibility.Collapsed;
 | 
						|
        }
 | 
						|
 | 
						|
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
						|
        {
 | 
						|
            throw new NotImplementedException();
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |