Ejemplo n.º 1
0
        public void CardbuttonClick(object sender, RoutedEventArgs e)
        {
            var b = (Button)sender;
            var c = new Card(b.Content.ToString());

            for (var i = 0; i < amount; i++)
            {
                if (c.ToString() == Cards[i].ToString())
                {
                    correctCount++;
                    leftCount         = amount - correctCount;
                    correctBlock.Text = correctCount.ToString();
                    leftBlock.Text    = leftCount.ToString();
                    correctCards[correctCount - 1] = Cards[i];
                    Cards[i] = Card.Null();
                    return;
                }
            }
            wrongCount++;
            //wrongCardsCount++;
            //wrongCards[wrongCardsCount - 1] = Cards[amount - wrongCount];
            for (var i = amount - 1; i >= 0; i--)
            {
                if (Cards[i].ToString() != "0")
                {
                    wrongCards[wrongCardsCount++] = Cards[i];
                    Cards[i]        = Card.Null();
                    wrongBlock.Text = wrongCount.ToString();
                    if (i > 0)
                    {
                        return;
                    }
                }
            }
            for (var i = 0; i < amount; i++)
            {
                Cards[i] = wrongCards[i];
            }
            wrongCards      = Card.CardNullArray(amount);
            wrongCardsCount = 0;
            scoreCount++;
            scoreBlock.Text = scoreCount.ToString();

            cardBox.Text = "";
            foreach (var i in Cards)
            {
                cardBox.Text += i.ToString() + ' ';
            }
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            //Main.Init();

            start.Click += StartClick;

            timer        = new Timer(1000);
            Cards        = Card.CardArray(amount);
            correctCards = Card.CardNullArray(amount);
            wrongCards   = Card.CardNullArray(amount);
            //for (var i = 0; i < amount; i++)
            //{
            //	correctCards[i] = new Card();
            //}

            leftBlock.Text = amount.ToString();

            //timer.Elapsed += TimerTenSec;
            ////timer.Interval = 5000;
            //timer.AutoReset = true;
            //timer.Enabled = true;

            //button1_6.Click -= Azaza;
            //button1_6.Click += new RoutedEventHandler(button1_6Click);
            //button1_6.Click += button1_6Click;
            //button1_6.Click += button1_6Click;
            //button1_7.Click += button1_7Click;
            //button1_8.Click += button1_8Click;
            //button1_9.Click += button1_9Click;
            //button1_10.Click += button1_10Click;
            //button1_J.Click += button1_JClick;
            //button1_Q.Click += button1_QClick;
            //button1_K.Click += button1_KClick;
            //button1_A.Click += button1_AClick;
            //button2_6.Click += button2_6Click;
            //button2_7.Click += button2_7Click;
            //button2_8.Click += button2_8Click;
            //button2_9.Click += button2_9Click;
            //button2_10.Click += button2_10Click;
            //button2_J.Click += button2_JClick;
            //button2_Q.Click += button2_QClick;
            //button2_K.Click += button2_KClick;
            //button2_A.Click += button2_AClick;
            //button3_6.Click += button3_6Click;
            //button3_7.Click += button3_7Click;
            //button3_8.Click += button3_8Click;
            //button3_9.Click += button3_9Click;
            //button3_10.Click += button3_10Click;
            //button3_J.Click += button3_JClick;
            //button3_Q.Click += button3_QClick;
            //button3_K.Click += button3_KClick;
            //button3_A.Click += button3_AClick;
            //button4_6.Click += button4_6Click;
            //button4_7.Click += button4_7Click;
            //button4_8.Click += button4_8Click;
            //button4_9.Click += button4_9Click;
            //button4_10.Click += button4_10Click;
            //button4_J.Click += button4_JClick;
            //button4_Q.Click += button4_QClick;
            //button4_K.Click += button4_KClick;
            //button4_A.Click += button4_AClick;
            //button1_6.Click += button1_6Click;
            //button1_6.Click += button1_6Click;
            //button1_7.Click += button1_7Click;
            //button1_8.Click += button1_8Click;
            //button1_9.Click += button1_9Click;
            //button1_10.Click += button1_10Click;
            //button1_J.Click += button1_JClick;
            //button1_Q.Click += button1_QClick;
            //button1_K.Click += button1_KClick;
            //button1_A.Click += button1_AClick;
            //button2_6.Click += button2_6Click;
            //button2_7.Click += button2_7Click;
            //button2_8.Click += button2_8Click;
            //button2_9.Click += button2_9Click;
            //button2_10.Click += button2_10Click;
            //button2_J.Click += button2_JClick;
            //button2_Q.Click += button2_QClick;
            //button2_K.Click += button2_KClick;
            //button2_A.Click += button2_AClick;
            //button3_6.Click += button3_6Click;
            //button3_7.Click += button3_7Click;
            //button3_8.Click += button3_8Click;
            //button3_9.Click += button3_9Click;
            //button3_10.Click += button3_10Click;
            //button3_J.Click += button3_JClick;
            //button3_Q.Click += button3_QClick;
            //button3_K.Click += button3_KClick;
            //button3_A.Click += button3_AClick;
            //button4_6.Click += button4_6Click;
            //button4_7.Click += button4_7Click;
            //button4_8.Click += button4_8Click;
            //button4_9.Click += button4_9Click;
            //button4_10.Click += button4_10Click;
            //button4_J.Click += button4_JClick;
            //button4_Q.Click += button4_QClick;
            //button4_K.Click += button4_KClick;
            //button4_A.Click += button4_AClick;


            button1_6.Click  += CardbuttonClick;
            button1_6.Click  += CardbuttonClick;
            button1_7.Click  += CardbuttonClick;
            button1_8.Click  += CardbuttonClick;
            button1_9.Click  += CardbuttonClick;
            button1_10.Click += CardbuttonClick;
            button1_J.Click  += CardbuttonClick;
            button1_Q.Click  += CardbuttonClick;
            button1_K.Click  += CardbuttonClick;
            button1_A.Click  += CardbuttonClick;
            button2_6.Click  += CardbuttonClick;
            button2_7.Click  += CardbuttonClick;
            button2_8.Click  += CardbuttonClick;
            button2_9.Click  += CardbuttonClick;
            button2_10.Click += CardbuttonClick;
            button2_J.Click  += CardbuttonClick;
            button2_Q.Click  += CardbuttonClick;
            button2_K.Click  += CardbuttonClick;
            button2_A.Click  += CardbuttonClick;
            button3_6.Click  += CardbuttonClick;
            button3_7.Click  += CardbuttonClick;
            button3_8.Click  += CardbuttonClick;
            button3_9.Click  += CardbuttonClick;
            button3_10.Click += CardbuttonClick;
            button3_J.Click  += CardbuttonClick;
            button3_Q.Click  += CardbuttonClick;
            button3_K.Click  += CardbuttonClick;
            button3_A.Click  += CardbuttonClick;
            button4_6.Click  += CardbuttonClick;
            button4_7.Click  += CardbuttonClick;
            button4_8.Click  += CardbuttonClick;
            button4_9.Click  += CardbuttonClick;
            button4_10.Click += CardbuttonClick;
            button4_J.Click  += CardbuttonClick;
            button4_Q.Click  += CardbuttonClick;
            button4_K.Click  += CardbuttonClick;
            button4_A.Click  += CardbuttonClick;
        }