public IEnumerable Handle(Func <Guid, MatchAggregate> al, SaveMatch command) { var agg = al(command.Id); if (agg.EventsLoaded > 0) { throw new MatchAlreadyCreated(); } yield return(new MatchCreated { Id = command.Id, TournamentId = command.TournamentId, Year = command.Year, Division = command.Division, IsPOA = command.IsPOA, Home = command.Home, Away = command.Away, Centre = command.Centre, CentreName = command.CentreName, Lane = command.Lane, Slot = command.Slot, Number = command.Number }); }
public Summary(SaveMatch saveMatch, ref SQLBase db) { NavigationPage.SetHasNavigationBar(this, false); sets = new Settings(); myBaseSqlite = db; match = saveMatch; VievModel = new Players(myBaseSqlite); EloExist(); SaveToBase(); InitializeComponent(); InitalizeLabel(); this.BindingContext = match; //logi sets.AddLogs(DateTime.Now.ToString()); sets.AddLogs(match.InfoDebug); sets.EndLog(); List <Player> players = myBaseSqlite.GetPlayersList(); foreach (Player item in players) { System.Diagnostics.Debug.WriteLine("Player " + item.name + "elo = " + item.elo); sets.AddLogs("Player " + item.name + "elo = " + item.elo); } sets.EndLog(); System.Diagnostics.Debug.WriteLine("MultiplerFromPlace() * MultiplerFromPlayerCount() * MultiplerFromRoundCount() * MultiplerFromMatchCount() * MultiplerFromArrowCount() * MultiplerFromRatio() + MultiplerEloRelation() + BonusForFirstMatch())"); sets.AddLogs("MultiplerFromPlace() * MultiplerFromPlayerCount() * MultiplerFromRoundCount() * MultiplerFromMatchCount() * MultiplerFromArrowCount() * MultiplerFromRatio() + MultiplerEloRelation() + BonusForFirstMatch())\n"); foreach (KeyValuePair <int, GameScore> item in match.DictGameScore()) { if (!(item.Value is null)) { item.Value.InfoDebug(); item.Value.InfoDebug2(); sets.AddLogs(item.Value.InfoDebug()); sets.AddLogs(item.Value.InfoDebug2()); System.Diagnostics.Debug.WriteLine(item.Value.RatioRecord + "<-RadioRecord|" + item.Value.name + "|BestShoot-> " + item.Value.BestShotFlag); sets.AddLogs(item.Value.RatioRecord + "<-RadioRecord|" + item.Value.name + "|BestShoot-> " + item.Value.BestShotFlag); } } sets.EndLog(); }
private void SwitchOnOffButton(int id) { Button btn; Entry ent; GameScore score; lastID = id; DictScoreFiled().TryGetValue(id, out ent); DictGameScore().TryGetValue(id, out score); if (ent != null) { if (Int32.TryParse(ent.Text, out int value)) { if (value >= 0 && value <= game.MaxScore) { if (value >= Math.Ceiling((decimal)((game.ArrowCount * 3f) / 2f))) { playerMp3.PlayArrow(); } if (value == 0) { playerMp3.PlayPeacefull(); } if (id == game.PlayerCount) { DictPlayerField().TryGetValue(id, out btn); ent.IsEnabled = false; btn.IsEnabled = false; score.ScoreEveryRound(game.CurrentRound, value); score.Sum += value; game.ChangeColorSums(); ent.Text = null; // usuwanie punktów DictPlayerField().TryGetValue(1, out btn); DictScoreFiled().TryGetValue(1, out ent); ent.IsEnabled = true; btn.IsEnabled = true; game.CurrentRound++; if (game.CurrentRound > game.RoundCount) { SwitchOffAll(); WhoWin(out string name, out GameScore[] sortedPlayer); DisplayAlert("Info", $"Wygrał {name}", "OK"); SaveMatch saveMatch = new SaveMatch(game.ArrowCount, game.RoundCount, game.PlayerCount, sortedPlayer); saveMatch.SaveGame(game); Navigation.PushAsync(new Summary(saveMatch, ref myBaseSqlite)); } } else { DictPlayerField().TryGetValue(id, out btn); btn.IsEnabled = false; ent.IsEnabled = false; score.ScoreEveryRound(game.CurrentRound, value); score.Sum += value; game.ChangeColorSums(); ent.Text = null; DictPlayerField().TryGetValue(id + 1, out btn); DictScoreFiled().TryGetValue(id + 1, out ent); btn.IsEnabled = true; ent.IsEnabled = true; } } else { DisplayAlert("Info", $"Wprowadź wartość liczbową od 0 do {game.MaxScore}", "OK"); DictScoreFiled().TryGetValue(id, out ent); ent.Text = String.Empty; } } else { DisplayAlert("Info", $"Wprowadź wartość liczbową od 0 do {game.MaxScore}", "OK"); DictScoreFiled().TryGetValue(id, out ent); ent.Text = String.Empty; } } else { DisplayAlert("Info", $"Wprowadź wartość liczbową od 0 do {game.MaxScore}", "OK"); } }