/// <summary> /// /// Adds a round to the history, bumping the oldest round off the end of the /// history, if adding the new round would make the list longer than the maximum /// /// </summary> /// <param name="newRound"></param> public void Push(Round newRound) { if (Rounds.Count == maxLength) { Rounds.RemoveAt(maxLength - 1); } Rounds.Insert(0, newRound); }
private void PerformMove() { var round = GameService.NextRound(SelectedMove); Rounds.Insert(0, round); if (GameService.IsGameOver()) { PerformMoveCommand.RaiseCanExecuteChanged(); PrintResult(round.Result); } }
public async Task LoadDataAsync() { if (IsBusy) { return; } IsBusy = true; // load lookups for the Round model await azureService.LoadCourseLookup(); await azureService.LoadPlayerLookup(); await azureService.LoadSocietyLookup(Preferences.Get("PlayerId", string.Empty)); await azureService.LoadCompetitionLookup(Preferences.Get("SocietyId", string.Empty)); // get competition // _selectedCompetition = await azureService.GetCompetition(_competitionId); // CompetitionName = Competition.CompetitionName; Title = Competition.CompetitionName; //Load rounds Rounds = await azureService.GetRoundsForCompetition(Competition.CompetitionId); // all overall selector Rounds.Insert(0, new Round() { RoundId = "ALL", RoundDate = Competition.StartDate }); // set round in picker if (Rounds.Count > 1) { // if saved round in in list, select it, otherwise select first one Round prefRound = Rounds.FirstOrDefault(o => o.RoundId == Preferences.Get("RoundId", null)); if (prefRound != null) { SelectedRound = prefRound; } else { SelectedRound = Rounds.FirstOrDefault(); } } IsBusy = false; }