public void UpdateCell(Ranking record) { bool isBonus = false; if (record.IsBonusGame.HasValue) isBonus = (bool)record.IsBonusGame; long score; if (record.TournamentId > 0) { if (record.RankingType == RankingType.Global || record.RankingType == RankingType.Missing) score = (long)record.GamesPlayed; else score = (long)record.Score; } else score = 0; if (isBonus || (record.RankingType == RankingType.Global && record.BonusPlayed > 0)) { positionLabel.TextColor = UIColor.FromRGB(0.4f, 1.0f, 0.4f); nameLabel.TextColor = UIColor.FromRGB(0.4f, 1.0f, 0.4f); scoreLabel.TextColor = UIColor.FromRGB(0.4f, 1.0f, 0.4f); pointsLabel.TextColor = UIColor.FromRGB(0.4f, 1.0f, 0.4f); } else { positionLabel.TextColor = UIColor.Black; nameLabel.TextColor = UIColor.Black; scoreLabel.TextColor = UIColor.Black; pointsLabel.TextColor = UIColor.Black; } if (record.RankingType == RankingType.Missing) { positionLabel.Text = string.Format ("{0}.", record.Position); scoreLabel.Text = string.Format ("{0:n0}", record.GamesPlayed); pointsLabel.Text = string.Format ("{0:n0}", record.BonusPlayed); } else if (score > 0) { scoreLabel.Text = string.Format ("{0:n0}", score); if (record.Position > 0) { positionLabel.Text = string.Format ("{0}.", record.Position); pointsLabel.Text = record.Points.ToString (); } else { positionLabel.Text = ""; pointsLabel.Text = ""; } } else { scoreLabel.Text = ""; positionLabel.Text = ""; pointsLabel.Text = ""; } if (record.EntryNumber.HasValue) { nameLabel.Text = string.Format("{0} ({1})", record.Name, record.EntryNumber); } else { nameLabel.Text = record.Name; } }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { SelectedItem = tableList[indexPath.Row]; if (this.ItemSelected != null) this.ItemSelected (this, new EventArgs ()); }