Exemplo n.º 1
0
        private void setTime(object sender, EventArgs e)
        {
            try
            {
                connectDB conn    = new connectDB();
                string    sqlDate = null;

                //Send actual time to textBlock
                actualTimeBlock.Text = getTime().ToString();

                //Get Time from DB
                sqlDate = conn.selectTimeDB().Rows[0][0].ToString();
                DateTime time = DateTime.Parse(sqlDate);

                //Porównanie tylko w sekundach bo bedzie problem z godiznami 15:03 != 14:30
                if ((Convert.ToInt32(getTime().ToString("mm"))) >= (Convert.ToInt32(time.ToString("mm"))))
                {
                    startTime(true);

                    //Set enable button to start
                    enterEg.IsEnabled  = true;
                    tabGame.Visibility = Visibility.Visible;
                }
            }catch (Exception xe)
            {
            }
        }
Exemplo n.º 2
0
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            connectDB conn = new connectDB();
            player    p    = new player();

            string sqlDate = null;

            if (loginBox.Text.ToString() != null && emailBox.Text.ToString() != null && passwordBox.Password != null)
            {
                try
                {
                    p.game(loginBox.Text.ToString(), emailBox.Text.ToString());

                    conn.decodeConnection(passwordBox.Password);
                    MessageBox.Show("Pomyslnie zarejestrowano uzytkownika! Czekaj na start matury!");
                    loginBtn.IsEnabled = false;

                    timeToStartBlock.Visibility = Visibility.Visible;

                    sqlDate = conn.selectTimeDB().Rows[0][0].ToString();

                    DateTime time = DateTime.Parse(sqlDate);

                    //When start?
                    timeToStartBlock.Text = time.ToString();
                    //MessageBox.Show(time.ToString());
                    startTime(false);
                }
                catch (Exception xe)
                {
                    MessageBox.Show("Error: " + xe.Message);
                }
            }
        }
Exemplo n.º 3
0
        public void sendStats(string time)
        {
            connectDB con = new connectDB();

            MessageBox.Show("Gracz: " + nick + " email: " + email + " punktów: " + points + " czas: " + time);

            con.insertDB(nick, email, points, time);
        }
Exemplo n.º 4
0
        private void DRadial_Checked(object sender, RoutedEventArgs e)
        {
            connectDB con = new connectDB();
            player    p   = new player();
            int       qN  = Convert.ToInt32(qNumberBox.Text.ToString());
            DataTable dt  = con.getQ(qN) as DataTable;
            string    z   = dt.Rows[0]["PoprawnaOdpowiedz"].ToString();

            if (DRadial.Content.ToString() == z)
            {
                MessageBox.Show("Correct!");
                p.addPoints();
            }
        }
Exemplo n.º 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            connectDB con = new connectDB();

            try
            {
                //con.getQ(1);
                DataTable dt = con.getQ(2) as DataTable;
                MessageBox.Show(dt.Rows[0]["TrescPytania"].ToString());
            }
            catch (Exception xe)
            {
                MessageBox.Show(xe.Message);
            }
        }
Exemplo n.º 6
0
        private void setQuestion(int qN)
        {
            connectDB con = new connectDB();
            player    p   = new player();
            DataTable dt  = con.getQ(qN) as DataTable;
            string    q   = "SELECT MAX(NumerPytania) FROM matura;";
            DataTable cdt = con.customSelect(q);

            // Select MAX("NumerPytania") FROM matura;
            allQuestion.Text = cdt.Rows[0][0].ToString();

            qNumberBox.Text = dt.Rows[0]["NumerPytania"].ToString();
            if (Convert.ToInt32(qNumberBox.Text) == Convert.ToInt32(allQuestion.Text))
            {
                finishBtn.IsEnabled = true;
            }

            questionBox.Text = dt.Rows[0]["TrescPytania"].ToString();
            answerA.Text     = dt.Rows[0]["OdpowiedzA"].ToString();
            answerB.Text     = dt.Rows[0]["OdpowiedzB"].ToString();
            answerC.Text     = dt.Rows[0]["OdpowiedzC"].ToString();
            answerD.Text     = dt.Rows[0]["OdpowiedzD"].ToString();
        }