122 lines
3.2 KiB
C#
122 lines
3.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 > 0)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
return Visibility.Collapsed;
|
|
}
|
|
}
|
|
//清空按钮的显示与隐藏
|
|
if(parameter.ToString().Equals("clearVisuability"))
|
|
{
|
|
if (status == 1)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
return Visibility.Collapsed;
|
|
}
|
|
}
|
|
//清空按钮的操作状态
|
|
if(parameter.ToString().Equals("clearBtnLoading"))
|
|
{
|
|
if (status == 0)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
//标定按钮的操作状态
|
|
if(parameter.ToString().Equals("biaoDingBtnLoading"))
|
|
{
|
|
if (status >3)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|