using System; //---------------------------------------------------------------- //Module Name: $safeprojectname$ //Purpose: //CopyRight: Muchinfo //History: //---------------------------------------------------------------- //DateTime 2016/5/10 18:58:00 //Author //Description Create //---------------------------------------------------------------- using System.Windows; using System.Windows.Data; namespace Muchinfo.MTPClient.Infrastructure.Converters { public class TradeModeVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null && parameter != null) { try { int paramValue; eTradeMode tradeMode; if (!int.TryParse(parameter.ToString(), out paramValue)) { paramValue = 0; } if (!Enum.TryParse(value.ToString(), out tradeMode)) { tradeMode = eTradeMode.TRADEMODE_MARKETMAKE; } ////parameter == 0; 即期模式报价 if (paramValue.Equals(0) && tradeMode == eTradeMode.TRADEMODE_MARKETMAKE) return Visibility.Visible; ////parameter == 1; 竞价模式报价 //if (paramValue.Equals(1) && // (tradeMode == eTradeMode.TRADEMODE_BIDDING || // tradeMode == eTradeMode.TRADEMODE_BIDDINGMARKETMAKE)) return Visibility.Visible; if (paramValue.Equals(1) && (tradeMode == eTradeMode.TRADEMODE_BIDDING)) return Visibility.Visible; return Visibility.Collapsed; } catch { return Visibility.Collapsed; } } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return false; } } }