Пример #1
0
        //CREATE GAME..................................................
        private void CreateGameAndCancel(object control, EventArgs e)
        {
            Button bttn            = (Button)control;
            string FirstMoveHandle = textBox3.Text;
            int    numberCount     = 0;

            if (bttn.AccessibleName != "Cancel")
            {
                if (textBox1.Text != "" && textBox2.Text != "")
                {
                    bool cond = true;
                    if (textBox1.Text == textBox3.Text || textBox2.Text == textBox3.Text)
                    {
                        cond = true;
                    }
                    else
                    {
                        cond = false;
                    }
                    if (cond == true)
                    {
                        foreach (Control TextBoxCheck in JarOfPlayerSegment.Controls)
                        {
                            if (TextBoxCheck.GetType() == typeof(TextBox))
                            {
                                numberCount++;
                                if (TextBoxCheck.AccessibleName != "FirstMove")
                                {
                                    if (FirstMoveHandle == TextBoxCheck.Text)
                                    {
                                        handleData[0]   = TextBoxCheck.Text;
                                        handleXandOA[0] = "X";
                                        handleXandOS    = handleXandOA[0];
                                    }
                                }

                                if (numberCount == 3)
                                {
                                    foreach (Control TextBoxCheck2 in JarOfPlayerSegment.Controls)
                                    {
                                        if (TextBoxCheck2 is TextBox)
                                        {
                                            if (TextBoxCheck2.AccessibleName != "FirstMove")
                                            {
                                                if (FirstMoveHandle != TextBoxCheck2.Text)
                                                {
                                                    handleData[1]   = TextBoxCheck2.Text;
                                                    handleXandOA[1] = "O";
                                                }
                                            }
                                        }
                                    }

                                    GamePanel.Visible          = true;
                                    JarOfPlayerSegment.Visible = false;
                                    JarOfNameMove.Text         = FirstMoveHandle;
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Sorry.... Please select the first move player.............");
                    }
                }
                else
                {
                    MessageBox.Show("Sorry.... The textbox is empty.............");
                }
            }
            else
            {
                JarOfPlayerSegment.Visible = false;
            }
        }