using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Data; namespace Muchinfo.MTPClient.Infrastructure.Converters { public class NumToButtonIsEnabledConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { //pValue_hValue_countNum//pValue确认票给付,hValue确认货给付,countNum交割单号数量 string[] result = value.ToString().Split(','); if (result.Count() > 2) { if (result[2] != null && result[1] != null && result[0] != null) { //pValue_hValue默认不填写的情况 if (int.Parse(result[0].ToString()) == 0 && int.Parse(result[1].ToString()) == 0) { if (int.Parse(result[0].ToString()) == 2) { return false; } else { return true; } } else { #region 默认填写的情况判断 if ((int.Parse(result[0].ToString()) == 100 || int.Parse(result[1].ToString()) == 100) && int.Parse(result[2].ToString()) == 1) { return false; } else if ((int.Parse(result[0].ToString()) != 100 && int.Parse(result[1].ToString()) != 100) && int.Parse(result[2].ToString()) == 2) { return false; } else { return true; } #endregion } } } return false; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }