private void UpdateRaces(RlmGetRacesResponse races) { this.NumLanes = races.NumLanes; this.LaneNames = GetLaneNames(this.NumLanes); this.NumRaces = races.NumRaces; this.RaceNames = GetRaceNames(this.NumRaces); this.NumCars = races.NumCars; this.CarNames = GetCarNames(races.RacesByCar); this.Races.Clear(); foreach (IRace race in races.Races) { this.Races.Add(new RaceViewModel(race)); } this.Cars.Clear(); foreach (RlmGetRacesResponse.CarRaces carRaces in races.RacesByCar) { this.Cars.Add(new CarRacesViewModel(carRaces)); } this.DataChanged?.Invoke(this, new EventArgs()); }
public LineupControlViewModel(int tournamentID) { this.TournamentID = tournamentID; this.Races = new List <RaceViewModel>(); this.Cars = new List <CarRacesViewModel>(); RlmGetRacesResponse races = TournamentManager.GetRaces(tournamentID); TournamentManager.RacesUpdated += TournamentManager_RacesUpdated; UpdateRaces(races); }
private void UpdateRaces(RlmGetRacesResponse racesResponse, IRace currentRace = null) { this.Races.Clear(); foreach (IRace race in racesResponse.Races) { EditRaceViewModel vm = new EditRaceViewModel(this.TournamentID, race); if ((currentRace != null) && (vm.RaceNumber == currentRace.RaceNumber)) { vm.CurrentRace = true; } this.Races.Add(vm); } }