示例#1
0
        partial void ButtonRestart_TouchUpInside(UIButton sender)
        {
            LabelWinner.Text = "";
            //ButtonOne.TitleLabel.Text = "";
            ButtonOne.Enabled = true;
            ButtonOne.SetTitle("", UIControlState.Normal);
            string btnOne = ButtonOne.Title(UIControlState.Normal);

            //  ButtonTwo.TitleLabel.Text = "";
            ButtonTwo.Enabled = true;
            ButtonTwo.SetTitle("", UIControlState.Normal);
            string btnTwo = ButtonTwo.Title(UIControlState.Normal);

            // ButtonTwo.SetTitle("", UIControlState.Normal);
            // ButtonThree.TitleLabel.Text = "";
            ButtonThree.Enabled = true;
            ButtonThree.SetTitle("", UIControlState.Normal);
            string btnThree = ButtonThree.Title(UIControlState.Normal);

            //  ButtonThree.SetTitle("", UIControlState.Normal);

            // ButtonFour.TitleLabel.Text = "";
            ButtonFour.Enabled = true;
            ButtonFour.SetTitle("", UIControlState.Normal);
            string btnFour = ButtonFour.Title(UIControlState.Normal);

            // ButtonFour.SetTitle("", UIControlState.Normal);

            // ButtonFive.TitleLabel.Text = "";

            ButtonFive.SetTitle("", UIControlState.Normal);
            ButtonFive.Enabled = true;
            string btnFive = ButtonFive.Title(UIControlState.Normal);

            // ButtonSix.TitleLabel.Text = "";
            ButtonSix.Enabled = true;
            ButtonSix.SetTitle("", UIControlState.Normal);
            string btnSix = ButtonSix.Title(UIControlState.Normal);


            // ButtonSeven.TitleLabel.Text = "";
            ButtonSeven.Enabled = true;
            ButtonSeven.SetTitle("", UIControlState.Normal);
            string btnSeven = ButtonSeven.Title(UIControlState.Normal);

            //  ButtonEight.TitleLabel.Text = "";
            ButtonEight.Enabled = true;
            ButtonEight.SetTitle("", UIControlState.Normal);
            string btnEight = ButtonEight.Title(UIControlState.Normal);

            //  ButtonNine.TitleLabel.Text = "";
            ButtonNine.Enabled = true;
            ButtonNine.SetTitle("", UIControlState.Normal);
            string btnNine = ButtonNine.Title(UIControlState.Normal);

            counter = 0;
        }
示例#2
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     ButtonOne.SetTitle("", UIControlState.Normal);
     ButtonTwo.SetTitle("", UIControlState.Normal);
     ButtonThree.SetTitle("", UIControlState.Normal);
     ButtonFour.SetTitle("", UIControlState.Normal);
     ButtonFive.SetTitle("", UIControlState.Normal);
     ButtonSix.SetTitle("", UIControlState.Normal);
     ButtonSeven.SetTitle("", UIControlState.Normal);
     ButtonEight.SetTitle("", UIControlState.Normal);
     ButtonNine.SetTitle("", UIControlState.Normal);
     LabelWinner.Text = "";
     // Perform any additional setup after loading the view, typically from a nib.
 }
示例#3
0
        partial void ButtonSeven_TouchUpInside(UIButton sender)
        {
            if (counter == 0)
            {
                ButtonSeven.SetTitle("X", UIControlState.Normal);
                ButtonSeven.SetTitleColor(UIColor.Black, UIControlState.Normal);
                counter++;
            }
            else if (counter == 1)
            {
                ButtonSeven.SetTitle("O", UIControlState.Normal);
                ButtonSeven.SetTitleColor(UIColor.Black, UIControlState.Normal);
                counter--;
            }

            ButtonSeven.Enabled = false;


            checkit();
        }
        void ReleaseDesignerOutlets()
        {
            if (ViewLabel != null)
            {
                ViewLabel.Dispose();
                ViewLabel = null;
            }

            if (ButtonZero != null)
            {
                ButtonZero.Dispose();
                ButtonZero = null;
            }

            if (ButtonOne != null)
            {
                ButtonOne.Dispose();
                ButtonOne = null;
            }

            if (ButtonTwo != null)
            {
                ButtonTwo.Dispose();
                ButtonTwo = null;
            }

            if (ButtonThree != null)
            {
                ButtonThree.Dispose();
                ButtonThree = null;
            }

            if (ButtonFour != null)
            {
                ButtonFour.Dispose();
                ButtonFour = null;
            }

            if (ButtonFive != null)
            {
                ButtonFive.Dispose();
                ButtonFive = null;
            }

            if (ButtonSix != null)
            {
                ButtonSix.Dispose();
                ButtonSix = null;
            }

            if (ButtonSeven != null)
            {
                ButtonSeven.Dispose();
                ButtonSeven = null;
            }

            if (ButtonEight != null)
            {
                ButtonEight.Dispose();
                ButtonEight = null;
            }

            if (ButtonNine != null)
            {
                ButtonNine.Dispose();
                ButtonNine = null;
            }

            if (ButtonPlus != null)
            {
                ButtonPlus.Dispose();
                ButtonPlus = null;
            }

            if (ButtonMinus != null)
            {
                ButtonMinus.Dispose();
                ButtonMinus = null;
            }

            if (ButtonMultiply != null)
            {
                ButtonMultiply.Dispose();
                ButtonMultiply = null;
            }

            if (ButtonDivide != null)
            {
                ButtonDivide.Dispose();
                ButtonDivide = null;
            }

            if (ButtonEquals != null)
            {
                ButtonEquals.Dispose();
                ButtonEquals = null;
            }

            if (ButtonClear != null)
            {
                ButtonClear.Dispose();
                ButtonClear = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ButtonEight != null)
            {
                ButtonEight.Dispose();
                ButtonEight = null;
            }

            if (ButtonFive != null)
            {
                ButtonFive.Dispose();
                ButtonFive = null;
            }

            if (ButtonFour != null)
            {
                ButtonFour.Dispose();
                ButtonFour = null;
            }

            if (ButtonNine != null)
            {
                ButtonNine.Dispose();
                ButtonNine = null;
            }

            if (ButtonOne != null)
            {
                ButtonOne.Dispose();
                ButtonOne = null;
            }

            if (ButtonRestart != null)
            {
                ButtonRestart.Dispose();
                ButtonRestart = null;
            }

            if (ButtonSeven != null)
            {
                ButtonSeven.Dispose();
                ButtonSeven = null;
            }

            if (ButtonSix != null)
            {
                ButtonSix.Dispose();
                ButtonSix = null;
            }

            if (ButtonThree != null)
            {
                ButtonThree.Dispose();
                ButtonThree = null;
            }

            if (ButtonTwo != null)
            {
                ButtonTwo.Dispose();
                ButtonTwo = null;
            }

            if (LabelTurn != null)
            {
                LabelTurn.Dispose();
                LabelTurn = null;
            }

            if (LabelWinner != null)
            {
                LabelWinner.Dispose();
                LabelWinner = null;
            }
        }
示例#6
0
        public void checkit()
        {
            //Check if tie
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") && !ButtonTwo.Title(UIControlState.Normal).Equals("") && !ButtonThree.Title(UIControlState.Normal).Equals("") &&
                !ButtonFour.Title(UIControlState.Normal).Equals("") && !ButtonFive.Title(UIControlState.Normal).Equals("") && !ButtonSix.Title(UIControlState.Normal).Equals("") &&
                !ButtonSeven.Title(UIControlState.Normal).Equals("") && !ButtonEight.Title(UIControlState.Normal).Equals("") && !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                LabelWinner.Text = "Tie";
            }

            //Check diagonal for X
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("X") && ButtonFive.Title(UIControlState.Normal).Equals("X") && ButtonNine.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonThree.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonSeven.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonThree.Title(UIControlState.Normal).Equals("X") && ButtonFive.Title(UIControlState.Normal).Equals("X") && ButtonSeven.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            //Check rows for X
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonTwo.Title(UIControlState.Normal).Equals("") || !ButtonThree.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("X") && ButtonTwo.Title(UIControlState.Normal).Equals("X") && ButtonThree.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonFour.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonSix.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonFour.Title(UIControlState.Normal).Equals("X") && ButtonFive.Title(UIControlState.Normal).Equals("X") && ButtonSix.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonSeven.Title(UIControlState.Normal).Equals("") || !ButtonEight.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonSeven.Title(UIControlState.Normal).Equals("X") && ButtonEight.Title(UIControlState.Normal).Equals("X") && ButtonNine.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            //Check columns for X
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonFour.Title(UIControlState.Normal).Equals("") || !ButtonSeven.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("X") && ButtonFour.Title(UIControlState.Normal).Equals("X") && ButtonSeven.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonTwo.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonEight.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonTwo.Title(UIControlState.Normal).Equals("X") && ButtonFive.Title(UIControlState.Normal).Equals("X") && ButtonEight.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonThree.Title(UIControlState.Normal).Equals("") || !ButtonSix.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonThree.Title(UIControlState.Normal).Equals("X") && ButtonSix.Title(UIControlState.Normal).Equals("X") && ButtonNine.Title(UIControlState.Normal).Equals("X"))
                {
                    LabelWinner.Text    = "Player X wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            //Check diagonal for O
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("O") && ButtonFive.Title(UIControlState.Normal).Equals("O") && ButtonNine.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonThree.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonSeven.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonThree.Title(UIControlState.Normal).Equals("O") && ButtonFive.Title(UIControlState.Normal).Equals("O") && ButtonSeven.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            //Check rows for O
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonTwo.Title(UIControlState.Normal).Equals("") || !ButtonThree.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("O") && ButtonTwo.Title(UIControlState.Normal).Equals("O") && ButtonThree.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonFour.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonSix.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonFour.Title(UIControlState.Normal).Equals("O") && ButtonFive.Title(UIControlState.Normal).Equals("O") && ButtonSix.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonSeven.Title(UIControlState.Normal).Equals("") || !ButtonEight.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonSeven.Title(UIControlState.Normal).Equals("O") && ButtonEight.Title(UIControlState.Normal).Equals("O") && ButtonNine.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            //Check columns for O
            if (!ButtonOne.Title(UIControlState.Normal).Equals("") || !ButtonFour.Title(UIControlState.Normal).Equals("") || !ButtonSeven.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonOne.Title(UIControlState.Normal).Equals("O") && ButtonFour.Title(UIControlState.Normal).Equals("O") && ButtonSeven.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonTwo.Title(UIControlState.Normal).Equals("") || !ButtonFive.Title(UIControlState.Normal).Equals("") || !ButtonEight.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonTwo.Title(UIControlState.Normal).Equals("O") && ButtonFive.Title(UIControlState.Normal).Equals("O") && ButtonEight.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
            if (!ButtonThree.Title(UIControlState.Normal).Equals("") || !ButtonSix.Title(UIControlState.Normal).Equals("") || !ButtonNine.Title(UIControlState.Normal).Equals(""))
            {
                if (ButtonThree.Title(UIControlState.Normal).Equals("O") && ButtonSix.Title(UIControlState.Normal).Equals("O") && ButtonNine.Title(UIControlState.Normal).Equals("O"))
                {
                    LabelWinner.Text    = "Player O wins";
                    ButtonOne.Enabled   = false;
                    ButtonTwo.Enabled   = false;
                    ButtonThree.Enabled = false;
                    ButtonFour.Enabled  = false;
                    ButtonFive.Enabled  = false;
                    ButtonSix.Enabled   = false;
                    ButtonSeven.Enabled = false;
                    ButtonEight.Enabled = false;
                    ButtonNine.Enabled  = false;
                }
            }
        }