async Task ExecuteLoadItemsCommandSeasons() { if (IsBusy) { return; } IsBusy = true; try { ds = await App.RestService.DriverStandingsBySeason(); cs = await App.RestService.ConstructorStandingsBySeason(); foreach (var item in data.Seasons) { item.DriverChampion = ds.Standings.Where(x => x.Season == item.Year).Select(x => x.DriverStandings[0].Driver).FirstOrDefault(); item.DriverConstructorChampion = ds.Standings.Where(x => x.Season == item.Year).Select(x => x.DriverConstructorChampion).FirstOrDefault(); item.ConstructorChampion = cs.Standings.Where(x => x.Season == item.Year).Select(x => x.ConstructorChampion).FirstOrDefault(); } LoadItemsFromData(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
/// <summary> /// Executes the load items command. /// </summary> async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Standings = await App.RestService.ConstructorStandingsByRace(Race.Season, Race.Round); Title = Race.Season + " " + Race.Name; Items.Clear(); foreach (var r in Standings.Standings[0].ConstructorStandings.OrderBy(x => x.Position).ThenBy(x => x.Wins)) { Items.Add(r); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public MRData(string xmlns, string series, string url, string limit, string offset, string total, StandingsTable standingsTable) { Xmlns = xmlns; Series = series; Url = url; Limit = limit; Offset = offset; Total = total; StandingsTable = standingsTable; }