/// <summary> /// Calculate and populate the Mob Trophy points table. /// </summary> private void PopulateMobTrophyTable() { foreach (ClubSeasonDetails clubSeasonDetail in this.model.Clubs) { MobTrophyPointsTableRowViewModel mobTrophyPoints = new MobTrophyPointsTableRowViewModel( clubSeasonDetail.Name, clubSeasonDetail.MobTrophy.TotalPoints, clubSeasonDetail.MobTrophy.TotalFinishingPoints.ToString(), clubSeasonDetail.MobTrophy.TotalPositionPoints.ToString(), clubSeasonDetail.MobTrophy.TotalBestPoints.ToString()); foreach (CommonPoints eventPoints in clubSeasonDetail.MobTrophy.Points) { mobTrophyPoints.AddPoints( new PointsType( eventPoints.FinishingPoints, eventPoints.PositionPoints, eventPoints.BestPoints, eventPoints.Date)); } MobTrophyPointsTable.Add(mobTrophyPoints); } MobTrophyPointsTable = new ObservableCollection <MobTrophyPointsTableRowViewModel>( MobTrophyPointsTable.OrderByDescending( order => order.TotalPoints)); }
/// <summary> /// Used to populate the Mob Trophy points table /// </summary> /// <param name="sender">sender object</param> /// <param name="e">event arguments</param> public void PopulateMobTrophyPointsData( object sender, EventArgs e) { MobTrophyPointsTable.Clear(); this.PopulateMobTrophyTable(); }