public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { GameAdvantage gameAdvantage = (GameAdvantage)value; int advantage = gameAdvantage.Advantage; int player = gameAdvantage.Player; string label = ""; string formatString = "{0} is winning by {1}"; if (advantage == 0) { label = "tie game"; } else if (advantage > 0) { label = player == 2 ? string.Format(formatString, "blue", advantage) : string.Format(formatString, "yellow", advantage); } return(label); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { GameAdvantage adv = (GameAdvantage)value; String score = ""; if (adv.Player == 1) { score = "Black is winning by " + adv.Advantage; } else if (adv.Player == 2) { score = "White is winning by " + adv.Advantage; } else { score = "Tie Game"; } return(score); }
private void SetAdvantage() { CurrentAdvantage = new GameAdvantage(mAdvantageValue > 0 ? 1 : mAdvantageValue < 0 ? 2 : 0, Math.Abs(mAdvantageValue)); }