private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox1.Text) && comboBox1.SelectedItem != null && comboBox2.SelectedItem != null)
            {
                //label4.Text = comboBox1.SelectedText;
                client.CreateGame(new Game {
                    Name = textBox1.Text
                });
                Game        game        = client.ChooseGame(textBox1.Text, false);
                Map         map         = client.ChooseMap(comboBox1.Text);
                QuestionSet questionSet = client.RetrieveQuestionSetByTitle(comboBox2.Text);
                client.AddMap(game, map);
                client.AddQuestionSet(game, questionSet);
                client.AddPlayer(game, PlayerCredentials.Instance.Player);


                MessageBox.Show("Game created!", "Info",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Hide();
                (new Lobby(game)).Show();
            }
            else
            {
                MessageBox.Show("All fields must be filled!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox1.Text) && comboBox2.SelectedItem != null)
            {
                QuestionSet questionSet = client.RetrieveQuestionSetByTitle(comboBox2.Text);

                client.CreateGame2(new Game {
                    Name = textBox1.Text
                }, questionSet.Title, Int32.Parse(maskedTextBox1.Text));
                Game game = client.RetrieveGame(textBox1.Text, false);;

                client.AddPlayer(game);

                this.Hide();
                (new Lobby(game, client)).Show();
            }
            else
            {
                MessageBox.Show("All fields must be filled!", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }