protected override void Invoke(MaterialChip sender) { short.TryParse(sender.Text, out short teamdId); if (sender.BindingContext is FootballMatchInfo matchInfo) { if (matchInfo.MatchStatus == FootballMatchStatusType.FT || matchInfo.MatchStatus == FootballMatchStatusType.AET || matchInfo.MatchStatus == FootballMatchStatusType.PEN) { sender.Text = $"{matchInfo.HomeScore} - {matchInfo.AwayScore}"; bool isDraw = matchInfo.HomeScore == matchInfo.AwayScore; bool isWin = matchInfo.HomeTeamId == teamdId ? matchInfo.HomeScore > matchInfo.AwayScore : matchInfo.HomeScore < matchInfo.AwayScore; sender.BackgroundColor = isDraw ? AppResourcesHelper.GetResourceColor("CustomGrey") : isWin?AppResourcesHelper.GetResourceColor("WinColor") : AppResourcesHelper.GetResourceColor("LoseColor"); } else { if (matchInfo.MatchStatus == FootballMatchStatusType.NS) { sender.Text = matchInfo.MatchStatus.ToString(); sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_D"); } else { sender.Text = $"{matchInfo.HomeScore} - {matchInfo.AwayScore}"; sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_L"); } } } }
protected override void Invoke(MaterialChip sender) { if (sender.BindingContext is FootballFixtureDetail fixtureDetail) { if (fixtureDetail.MatchStatus == FootballMatchStatusType.FT || fixtureDetail.MatchStatus == FootballMatchStatusType.AET || fixtureDetail.MatchStatus == FootballMatchStatusType.PEN) { sender.Text = $"{fixtureDetail.HomeTeamScore} - {fixtureDetail.AwayTeamScore}"; sender.BackgroundColor = AppResourcesHelper.GetResourceColor("CustomGrey_D"); } else { if (fixtureDetail.MatchStatus == FootballMatchStatusType.NS) { sender.Text = fixtureDetail.MatchStatus.ToString(); sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_D"); } else { sender.Text = $"{fixtureDetail.HomeTeamScore} - {fixtureDetail.AwayTeamScore}"; sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_L"); } } } else if (sender.BindingContext is FootballMatchInfo matchInfo) { if (matchInfo.MatchStatus == FootballMatchStatusType.FT || matchInfo.MatchStatus == FootballMatchStatusType.AET || matchInfo.MatchStatus == FootballMatchStatusType.PEN) { sender.Text = $"{matchInfo.HomeScore} - {matchInfo.AwayScore}"; sender.BackgroundColor = AppResourcesHelper.GetResourceColor("CustomGrey_D"); } else { if (matchInfo.MatchStatus == FootballMatchStatusType.NS) { sender.Text = matchInfo.MatchStatus.ToString(); sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_D"); } else { sender.Text = $"{matchInfo.HomeScore} - {matchInfo.AwayScore}"; sender.BackgroundColor = AppResourcesHelper.GetResourceColor("PrimaryColor_L"); } } } }