Example #1
0
        private void CreateBotton_Click(object sender, RoutedEventArgs e)
        {
            if (GameModeComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Please Choose Game Mode");
                return;
            }
            if (_minPlayer == -1)
            {
                MessageBox.Show("Please enter Minimum Playes");
                return;
            }
            if (_maxPlayers == -1)
            {
                MessageBox.Show("Please enter Maximum Playes");
                return;
            }
            if (_chipPolicy == -1)
            {
                MessageBox.Show("Please enter Chip Policy");
                return;
            }
            if (_buyInPolicy == -1)
            {
                MessageBox.Show("Please enter Buy-In Policy");
                return;
            }
            if (SpectatorsComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Please choose Spectetors Allowed");
                return;
            }
            if (_minBet == -1)
            {
                MessageBox.Show("Please enter Chip Policy");
                return;
            }
            GameDataCommMessage newRoom = _logic.CreateNewRoom(_mode, _minBet, _chipPolicy, _buyInPolicy, _canSpectate, _minPlayer, _maxPlayers);

            if (newRoom != null)
            {
                MessageBox.Show("New Room sucssesfully Created, Enjoy!");
                GameScreen newGameWindow = new GameScreen(_logic);

                newGameWindow.UpdateGame(newRoom);
                _logic.AddNewRoom(newGameWindow);
                newGameWindow.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("New room creation failed!");
            }
        }