public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            var result = Constants.UnknowColor;

            try
            {
                PlayerDBDTO player = (PlayerDBDTO)values[0];
                GameDBDTO   info   = (GameDBDTO)values[1];
                if (player != null && info != null)
                {
                    if (player.Team == info.WinTeam)
                    {
                        return(result = Constants.WinColor);
                    }
                    else
                    {
                        return(result = Constants.LoseColor);
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(result);
        }
示例#2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            PlayerDBDTO player = (PlayerDBDTO)(value);
            Double      result = 0;

            if (player != null)
            {
                Double k = System.Convert.ToDouble(player.K);
                Double d = System.Convert.ToDouble(player.D);
                Double a = System.Convert.ToDouble(player.A);
                result = (k + a) / d;
                if (Double.IsPositiveInfinity(result))
                {
                    return("∞");
                }
            }
            return(String.Format("{0:0.0}", result));
        }