private LiveMatchCell CreateActualTile(LiveMatchCell cell, Match match, Team homeTeam, Team awayTeam) { cell.Date.Text = match.Date.ToString(); cell.Time.LineBreakMode = UILineBreakMode.WordWrap; cell.Time.Text = Floorball.UIHelper.GetMatchTime(match.Time, match.State).Replace("\\n", " "); cell.HomeTeam.Text = homeTeam.Name; cell.HomeScore.Text = match.ScoreH.ToString(); cell.AwayTeam.Text = awayTeam.Name; cell.AwayScore.Text = match.ScoreA.ToString(); return(cell); }
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { if ((indexPath.Section == 0 && !HasLiveMatch) || (indexPath.Section == 1 && !HasSoonMatch)) { var cell = tableView.DequeueReusableCell("NoMatchCell"); cell.BackgroundColor = UIColor.Clear.FromHex(LightGreen.hex); return(cell); } Match match; Team homeTeam; Team awayTeam; if (indexPath.Section == 0) { if (LiveIndexes.Contains(indexPath.Row)) { return(CreateLeagueNameCell(tableView, indexPath, LiveIndexes)); } else { LiveMatchCell cell = tableView.DequeueReusableCell("LiveMatchCell", indexPath) as LiveMatchCell; cell.BackgroundColor = UIColor.Clear.FromHex(LightGreen.hex); var color = cell.ViewWithTag(500).BackgroundColor; //cell.ViewWithTag(500).BackgroundColor = cell.ViewWithTag(500).BackgroundColor.ColorWithAlpha((float)0.5);r match = LiveMatches.ElementAt(indexPath.Row - LiveIndexes.Where(i => i < indexPath.Row).Count()); homeTeam = LiveTeams.First(t => t.Id == match.HomeTeamId); awayTeam = LiveTeams.First(t => t.Id == match.AwayTeamId); if (match.State == StateEnum.Playing) { AnimateView(cell.ViewWithTag(800), true); } return(CreateActualTile(cell, match, homeTeam, awayTeam)); } } else { if (SoonIndexes.Contains(indexPath.Row)) { return(CreateLeagueNameCell(tableView, indexPath, SoonIndexes)); } else { LiveMatchCell cell = tableView.DequeueReusableCell("LiveMatchCell", indexPath) as LiveMatchCell; cell.BackgroundColor = UIColor.Clear.FromHex(LightGreen.hex); match = SoonMatches.ElementAt(indexPath.Row - SoonIndexes.Where(i => i < indexPath.Row).Count()); homeTeam = SoonTeams.First(t => t.Id == match.HomeTeamId); awayTeam = SoonTeams.First(t => t.Id == match.AwayTeamId); return(CreateActualTile(cell, match, homeTeam, awayTeam)); } } }