Esempio n. 1
0
        private void buttonConditionalFinish_Click(object sender, EventArgs e)
        {
            Profile.Finish++;

            var query = from o in DB.UserInfos
                        where o.UserName == LogIn.loginName
                        select o;

            UserInfo user = new UserInfo();

            user = query.First();

            user.ChapterCompleted = Profile.Finish;
            DB.SubmitChanges();
            buttonConditionalFinish.Enabled = false;

            this.Hide();
            TestTopics test = new TestTopics();

            test.buttonbasictest.Enabled     = false;
            test.buttonconditiontest.Enabled = false;
            test.buttonlooptest.Enabled      = true;
            test.buttonarraytest.Enabled     = false;
            test.buttonpointertest.Enabled   = false;
            test.buttonfunctiontest.Enabled  = false;
            test.buttonCertificate.Enabled   = false;
            test.Show();
        }
Esempio n. 2
0
        private void buttonBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            TestTopics test = new TestTopics();

            test.Show();
        }
Esempio n. 3
0
        private void timerFunction_Tick(object sender, EventArgs e)
        {
            duration--;
            textBoxFunction1.Text = duration.ToString();
            textBoxFunction2.Text = duration.ToString();
            if (duration == 0)
            {
                timerFunction.Stop();
                if (buttonFunctionFinish.Enabled == false)
                {
                }
                else
                {
                    MessageBox.Show("Time Out.");
                    Profile.Finish++;

                    var query = from o in DB.UserInfos
                                where o.UserName == LogIn.loginName
                                select o;

                    UserInfo user = new UserInfo();
                    user = query.First();

                    user.ChapterCompleted = Profile.Finish;
                    DB.SubmitChanges();
                    buttonFunctionFinish.Enabled = false;

                    this.Hide();
                    TestTopics test = new TestTopics();
                    test.buttonbasictest.Enabled     = false;
                    test.buttonconditiontest.Enabled = false;
                    test.buttonlooptest.Enabled      = false;
                    test.buttonarraytest.Enabled     = false;
                    test.buttonpointertest.Enabled   = false;
                    test.buttonfunctiontest.Enabled  = false;
                    if (user.Score >= 20)
                    {
                        test.buttonCertificate.Enabled = true;
                    }
                    else
                    {
                        MessageBox.Show("Sorry,you have failed to get reward.", "Message");
                        test.buttonCertificate.Enabled = false;
                    }
                    test.Show();
                }
            }
        }
Esempio n. 4
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            this.Hide();

            var query1 = from o in DB.UserInfos
                         where o.UserName == LogIn.loginName
                         select o;

            UserInfo user = new UserInfo();

            user = query1.First();

            Profile.Finish = user.ChapterCompleted;
            TestTopics test = new TestTopics();

            if (Profile.Finish == 0)
            {
                test.buttonconditiontest.Enabled = false;
                test.buttonlooptest.Enabled      = false;
                test.buttonarraytest.Enabled     = false;
                test.buttonpointertest.Enabled   = false;
                test.buttonfunctiontest.Enabled  = false;
                test.buttonCertificate.Enabled   = false;
            }
            if (Profile.Finish == 1)
            {
                test.buttonbasictest.Enabled    = false;
                test.buttonlooptest.Enabled     = false;
                test.buttonarraytest.Enabled    = false;
                test.buttonpointertest.Enabled  = false;
                test.buttonfunctiontest.Enabled = false;
                test.buttonCertificate.Enabled  = false;
            }
            if (Profile.Finish == 2)
            {
                test.buttonbasictest.Enabled     = false;
                test.buttonconditiontest.Enabled = false;
                test.buttonarraytest.Enabled     = false;
                test.buttonpointertest.Enabled   = false;
                test.buttonfunctiontest.Enabled  = false;
                test.buttonCertificate.Enabled   = false;
            }
            if (Profile.Finish == 3)
            {
                test.buttonbasictest.Enabled     = false;
                test.buttonconditiontest.Enabled = false;
                test.buttonlooptest.Enabled      = false;
                test.buttonpointertest.Enabled   = false;
                test.buttonfunctiontest.Enabled  = false;
                test.buttonCertificate.Enabled   = false;
            }
            if (Profile.Finish == 4)
            {
                test.buttonbasictest.Enabled     = false;
                test.buttonconditiontest.Enabled = false;
                test.buttonlooptest.Enabled      = false;
                test.buttonarraytest.Enabled     = false;
                test.buttonfunctiontest.Enabled  = false;
                test.buttonCertificate.Enabled   = false;
            }
            if (Profile.Finish == 5)
            {
                test.buttonbasictest.Enabled     = false;
                test.buttonconditiontest.Enabled = false;
                test.buttonlooptest.Enabled      = false;
                test.buttonarraytest.Enabled     = false;
                test.buttonpointertest.Enabled   = false;
                test.buttonCertificate.Enabled   = false;
            }
            if (Profile.Finish == 6)
            {
                test.buttonbasictest.Enabled     = false;
                test.buttonconditiontest.Enabled = false;
                test.buttonlooptest.Enabled      = false;
                test.buttonarraytest.Enabled     = false;
                test.buttonpointertest.Enabled   = false;
                test.buttonfunctiontest.Enabled  = false;
                if (user.Score >= 20)
                {
                    test.buttonCertificate.Enabled = true;
                }
            }
            if (user.Score < 20)
            {
                test.buttonCertificate.Enabled = false;
            }
            test.Show();
        }