Пример #1
0
 private void CreateDefaultGameTable()
 {
     GameTable = new GameTable()
     {
         Owner = _stateService.GetSavedPlayer(),
         Type  = GameTableType.Cards36And4Players,
         Name  = GameTableNameGenerator.Generate()
     };
 }
Пример #2
0
        public void Create()
        {
            if (_stateService.AlreadyPlaying)
            {
                throw new Exception("Игрок уже находится за игровым столом");
            }

            if (string.IsNullOrWhiteSpace(GameTable.Name))
            {
                GameTable.Name = GameTableNameGenerator.Generate();
            }

            _blockUIService.StartBlocking();

            _mainHubApi.CreateGameTable(new CreateGameTableParams()
            {
                Name          = GameTable.Name,
                OwnerId       = _stateService.GetSavedPlayer().Id,
                GameTableType = GameTable.Type
            })
            .Then(response =>
            {
                if (response.Succeeded)
                {
                    _stateService.SetGameTable(GameTable as GameTable);

                    _dispatcher.Invoke(() =>
                    {
                        Navigate <GameTableViewModel>();
                    });
                }
            })
            .Finally(() =>
            {
                _dispatcher.Invoke(() =>
                {
                    _blockUIService.StopBlocking();
                });
            });
        }