public async Task Submit(PlayerContestRegistration registration) { if (registration.GameId.Equals(Guid.Empty)) registration.GameId = Guid.NewGuid(); var command = new RegisterPlayerToContest() { ContestId = registration.ContestId, GameId = registration.GameId, PlayerName = registration.PlayerName }; _commandBus.Publish(command); await Task.FromResult<object>(null); }
public async Task Submit() { if (!this.CanSubmit()) { throw new InvalidOperationException(); } PlayerContestRegistration registration = new PlayerContestRegistration() { ContestId = this.ContestId, PlayerName = this.PlayerName }; await _registrationService.Submit(registration); this.CloseViewRequested(this, EventArgs.Empty); }
public async Task NewGame() { try { this.BusyText = "Neue Karte wir erstellt..."; this.IsBusy = true; PlayerContestRegistration registration = new PlayerContestRegistration(); registration.ContestId = this.CurrentGame.ContestId; registration.GameId = Guid.NewGuid(); registration.PlayerName = this.CurrentGame.PlayerName; await _registrationService.Submit(registration); await Task.Delay(1000); bool found = false; SequencingItem sequence = null; while (!found) { sequence = await _contestDao.FindSequencingItem(registration.GameId); if (sequence != null) found = true; if (!found) await Task.Delay(500); } this.CurrentGame = sequence; } catch (Exception ex) { } finally { this.IsBusy = false; } }