Example #1
0
        private void changeLevelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            SelectLevel view = new SelectLevel();

            view.ShowDialog();
        }
Example #2
0
 private void ForTheWin()
 {
     if (clicks == (r * c) - m)
     {
         timer1.Stop();
         if (MessageBox.Show("You won! Continue?", "Winner!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SelectLevel newf = new SelectLevel();
             this.Hide();
             newf.ShowDialog();
             this.Close();
         }
         else
         {
             Application.Exit();
         }
     }
 }
Example #3
0
        private void ButtonClick(Button current, int[,] arr)
        {
            numbers = current.Name.ToString().Split(new string[] { "button r", "c" }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
            int row = numbers[0];
            int col = numbers[1];

            if (current.Text == "M")
            {
                return;
            }
            if (arr[row, col] == -1)
            {
                timer1.Stop();
                PictureBombs(array);
                if (MessageBox.Show("Wanna try again?", "Oops! Sorry!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Main.ActiveForm.Hide();
                    SelectLevel formObject = new SelectLevel();
                    formObject.ShowDialog();
                }
                else
                {
                    Application.Exit();
                }
            }
            else if (arr[row, col] == 0)
            {
                current.Text    = arr[row, col].ToString();
                current.Enabled = false;
                clicks++;
                OpenField(current, buttons);
                pause[row, col] = true;
            }
            else
            {
                current.Text    = arr[row, col].ToString();
                current.Enabled = false;
                clicks++;
                pause[row, col] = true;
            }
            ForTheWin();
        }