Ejemplo n.º 1
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            string mode = comboBox1.SelectedItem.ToString();

            if (mode.Equals("4 x 4"))
            {
                ClientForm4x4 clientForm4X4 = new ClientForm4x4();
                this.Hide();
                clientForm4X4.Show();
            }
            else if (mode.Equals("9 x 9"))
            {
                ClientForm9x9 clientForm9x9 = new ClientForm9x9();
                this.Hide();
                clientForm9x9.Show();
            }
        }
        private void addControlForAllButtonOfList(object sender, EventArgs e)
        {
            var button = sender as Button;

            int serial = int.Parse(button.Name.Substring(6));

            string b = combos[serial].SelectedItem.ToString();

            string s = idUser.Text;

            if (s.Equals(""))
            {
                MessageBox.Show("Vui lòng nhập ID!");
            }
            else if (checkID(s))
            {
                if (users1[serial].Text.Equals(""))
                {
                    Send("8x" + serial + idUser.Text);
                    Thread.Sleep(1000);


                    if (b.Equals("4x4"))
                    {
                        passingID     = int.Parse(idUser.Text);
                        passingRoomID = serial;
                        ClientForm4x4 clientForm4X4 = new ClientForm4x4();
                        clientForm4X4.Show();
                    }
                    else
                    {
                        passingID     = int.Parse(idUser.Text);
                        passingRoomID = serial;
                        ClientForm9x9 clientForm9X9 = new ClientForm9x9();
                        clientForm9X9.Show();
                    }
                }
                else if (users2[serial].Text.Equals(""))
                {
                    Send("8x" + serial + idUser.Text);
                    Thread.Sleep(1000);

                    if (b.Equals("4x4"))
                    {
                        passingID     = int.Parse(idUser.Text);
                        passingRoomID = serial;
                        ClientForm4x4 clientForm4X4 = new ClientForm4x4();
                        clientForm4X4.Show();
                    }
                    else
                    {
                        passingID     = int.Parse(idUser.Text);
                        passingRoomID = serial;
                        ClientForm9x9 clientForm9X9 = new ClientForm9x9();
                        clientForm9X9.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Bàn này đã đầy!");
                }
            }
            else
            {
                MessageBox.Show("ID này đã tồn tại, vui lòng nhập ID khác!");
            }
        }