Exemplo n.º 1
0
        private void Button_MouseRightButtonUp(object sender, MouseButtonEventArgs e) // флажок придумать!
        {
            var    btn = (Button)sender;
            string s   = btn.Content.ToString();

            btn.SetResourceReference(StackPanel.BackgroundProperty, "BG_7_Flag_BIB");
            if (s != "MM")
            {
                fine++;
            }
            else if (s == "MM")
            {
                Notfine++;
            }
            if (Notfine == CMina && fine == 0)
            {
                WinWindow proc = new WinWindow();
                proc.Show();
            }
        }
Exemplo n.º 2
0
        } //ok

        private void Check_Win()
        {
            bool         temp = true;
            StreamWriter sr   = new StreamWriter("Sample.txt");


            for (int i = 0; i < ListBut.Count; i++)
            {
                if (Convert.ToInt32(ListBut[i].Content) == i + 1)
                {
                    temp = true;
                }
                else
                {
                    temp = false; break;
                }
            }
            if (temp)
            {
                WinWindow proc = new WinWindow();
                proc.Show();
            }
            sr.Close();
        }
Exemplo n.º 3
0
        private void Click_Left_But(object sender, RoutedEventArgs e)
        {
            //Получаем текст кнопки
            string s = (string)((Button)e.OriginalSource).Content;

            if (s == "MM")
            {
                MessageBox.Show("BOOM"); Set_Full_Pole();
            }
            else
            {
                var btn = (Button)sender;

                int row = 0;
                int col = 0;

                //MessageBox.Show(btn.Content.ToString());
                for (int i = 1; i < 11; i++)
                {
                    for (int j = 1; j < 11; j++)
                    {
                        if (btn == BPole[i, j])
                        {
                            row = i; col = j;
                            //MessageBox.Show(i.ToString() + " " + j.ToString());
                            break;
                        }
                    }
                }

                int ch = 0;
                if ("MM" == BPole[row - 1, col - 1].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row - 1, col].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row - 1, col + 1].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row, col - 1].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row, col + 1].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row + 1, col - 1].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row + 1, col].Content.ToString())
                {
                    ch++;
                }
                if ("MM" == BPole[row + 1, col + 1].Content.ToString())
                {
                    ch++;
                }
                BPole[row, col].FontSize = 28;
                BPole[row, col].Content  = ch.ToString(); // ~image
                //BPole[row, col].SetResourceReference(StackPanel.BackgroundProperty, "BG_7_Flag_BIB");
                if (Notfine == CMina && fine == 0)
                {
                    //MessageBox.Show("WIN");
                    WinWindow proc = new WinWindow();


                    proc.Show();
                }
            }
        }