Пример #1
0
        /// <summary>
        /// Exit Button Click Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EXIT_BTN_Click(object sender, EventArgs e)
        {
            DialogResult tResult = MessageAlertForm.ShowMessage("EXIT?", MessageBoxButtons.OKCancel);

            if (tResult == DialogResult.OK)
            {
                AllDispose();
            }
        }
Пример #2
0
        public static DialogResult ShowMessage(String pMsg, MessageBoxButtons pMessageBoxButtons = MessageBoxButtons.OK)
        {
            using (MessageAlertForm tFrm = new MessageAlertForm())
            {
                tFrm.SetValue(pMsg, pMessageBoxButtons);
                DialogResult tResult = tFrm.ShowDialog();

                return(tResult);
            }
        }
Пример #3
0
        /// <summary>
        /// Victory Check Function (TASK)
        /// </summary>
        private void VictoryCheck()
        {
            while (true)
            {
                if (!mr.WaitOne(100))
                {
                    if (Buttons.Length > 0 && Buttons != null)
                    {
                        Thread.Sleep(300);

                        List <int> ButtonCheck           = new List <int>();
                        List <int> ButtonRightClickCheck = new List <int>();

                        for (int i = 0; i < Buttons.Length; i++)
                        {
                            if (Buttons[i].Text != "!")
                            {
                                ButtonRightClickCheck.Add(i);
                            }

                            if (Buttons[i].BackColor != Color.MediumAquamarine)
                            {
                                ButtonCheck.Add(i);
                            }
                        }

                        if (ButtonRightClickCheck.Count == MINE_COUNT)
                        {
                        }

                        if (ButtonCheck.Count != MINE_COUNT)
                        {
                            continue;
                        }

                        DialogResult dr = MessageAlertForm.ShowMessage("Victory   Retry?", MessageBoxButtons.OKCancel);

                        if (dr == DialogResult.OK)
                        {
                            Restart();
                        }
                        else if (dr == DialogResult.Cancel)
                        {
                            AllDispose();
                        }

                        break;
                    }
                }
            }
        }
Пример #4
0
        private void BtnClick_Event(object sender, MouseEventArgs e)
        {
            Button tBtn = (Button)sender;

            if (e.Button == MouseButtons.Left)
            {
                for (int i = 0; i < randPos.Length; i++)
                {
                    if (tBtn == Buttons[randPos[i]])
                    {
                        if (Buttons[randPos[i]].Text != "!")
                        {
                            Buttons[randPos[i]].Text = "※";

                            Thread.Sleep(500);

                            DialogResult tDR = MessageAlertForm.ShowMessage("GAME OVER   Retry?", MessageBoxButtons.OKCancel);

                            if (tDR == DialogResult.OK)
                            {
                                Restart();
                            }
                        }

                        return;
                    }
                }

                for (int i = 0; i < Buttons.Length; i++)
                {
                    if (tBtn == Buttons[i])
                    {
                        if (Buttons[i].Text != "!")
                        {
                            if (ButtonsMineCount[i] != 0)
                            {
                                Buttons[i].Text = ButtonsMineCount[i].ToString();
                            }
                            else
                            {
                                SpaceCheck(MakeSpaceArr(i), i);
                            }

                            Buttons[i].BackColor = Color.MediumAquamarine;
                        }

                        return;
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                for (int i = 0; i < Buttons.Length; i++)
                {
                    if (tBtn == Buttons[i])
                    {
                        if (Buttons[i].Text == "" && Buttons[i].BackColor != Color.MediumAquamarine)
                        {
                            Buttons[i].Text = "!";
                        }
                        else if (Buttons[i].Text == "!")
                        {
                            Buttons[i].Text = "";
                        }
                        return;
                    }
                }
            }
        }