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"); } } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Color returnValue = Color.Transparent; if (value is MatchResultType resultType) { switch (resultType) { case MatchResultType.Win: returnValue = AppResourcesHelper.GetResourceColor("WinColor"); break; case MatchResultType.Draw: returnValue = AppResourcesHelper.GetResourceColor("CustomGrey"); break; case MatchResultType.Lose: returnValue = AppResourcesHelper.GetResourceColor("LoseColor"); break; default: break; } } return(returnValue); }
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"); } } } }
public override bool OnInitializeView(params object[] datas) { var message = _bookmarkService.BuildBookmarkMessage(SportsType.Football, PageDetailType.Match); MessagingCenter.Subscribe <BookmarkService, FootballMatchInfo>(this, message, (s, e) => MatchBookmarkMessageHandler(e)); message = _notificationService.BuildNotificationMessage(SportsType.Football, NotificationType.MatchStart); MessagingCenter.Subscribe <NotificationService, NotificationInfo>(this, message, (s, e) => NotificationMessageHandler(e)); AlarmIcon = new ChangableIcon( "ic_alarm_selected.png", AppResourcesHelper.GetResourceColor("IconActivated"), "ic_alarm_unselected.png", AppResourcesHelper.GetResourceColor("TextColor_L")); return(true); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { var color = (Color)value; return(color == AppResourcesHelper.GetResourceColor("IconActivated") ? true : false); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isAlarmed = (bool)value; return(isAlarmed ? AppResourcesHelper.GetResourceColor("IconActivated") : AppResourcesHelper.GetResourceColor("CustomGrey")); }