private void join_Click(object sender, EventArgs e) { string res = client.joinRoom(roomsIdAndName[roomsList.SelectedIndex * 2], roomsIdAndName[roomsList.SelectedIndex * 2 + 1]); if (res.Equals("SUCCESS")) { WaitForGame W = new WaitForGame(client, roomsIdAndName[roomsList.SelectedIndex * 2], roomsIdAndName[roomsList.SelectedIndex * 2 + 1]); W.Owner = this.Owner; W.Show(); this.Close(); } else { errorLabel.Text = res; errorLabel.Visible = true; } }
private void send_Click(object sender, EventArgs e) { if (roomName.Text.Length > 99 || roomName.Text.Length < 1) { errorLabel.Visible = true; errorLabel.Text = "wrong room name"; return; } else if (Int32.Parse(numberOfPlayers.Text) > 9 || Int32.Parse(numberOfPlayers.Text) < 1) { errorLabel.Visible = true; errorLabel.Text = "wrong number of players"; return; } else if (Int32.Parse(numberOfQuestions.Text) > 99 || Int32.Parse(numberOfQuestions.Text) < 1) { errorLabel.Visible = true; errorLabel.Text = "wrong number of questions"; return; } else if (Int32.Parse(time.Text) > 99 || Int32.Parse(time.Text) < 1) { errorLabel.Visible = true; errorLabel.Text = "wrong time"; return; } string res = client.createRoom(roomName.Text, Int32.Parse(numberOfPlayers.Text), Int32.Parse(numberOfQuestions.Text), Int32.Parse(time.Text)); if (res.Equals("SUCCESS")) { WaitForGame W = new WaitForGame(client, "", roomName.Text); W.Owner = this.Owner; W.Show(); this.Close(); } else { errorLabel.Visible = true; errorLabel.Text = res; } }