Example #1
0
        private void Open_Quiz_Clicked(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            String         path   = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            dialog.InitialDirectory = path + "\\quizzes\\";
            dialog.DefaultExt       = ".txt";
            dialog.Filter           = "Text documents (.txt)|*.txt";

            Nullable <bool> result = dialog.ShowDialog();

            if (result == true)
            {
                if (QuizControl.loadQuiz(dialog.FileName))
                {
                    CloseQuizMenuItem.IsEnabled           = true;
                    JumpToFinalQuestionMenuItem.IsEnabled = true;
                }
                else
                {
                }
            }
            else
            {
            }
        }
Example #2
0
        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            xScale = ((float)e.NewSize.Width) / 800.0f;
            yScale = ((float)e.NewSize.Height) / 650.0f;

            JumpToFinalQuestionTextBlock.FontSize    = 12 * yScale;
            JumpToFinalQuestionOkButton.FontSize     = 12 * yScale;
            JumpToFinalQuestionCancelButton.FontSize = 12 * yScale;

            CloseQuizTextBlock.FontSize    = 12 * yScale;
            CloseQuizOkButton.FontSize     = 12 * yScale;
            CloseQuizCancelButton.FontSize = 12 * yScale;

            QuitTextBlock.FontSize    = 12 * yScale;
            QuitOkButton.FontSize     = 12 * yScale;
            QuitCancelButton.FontSize = 12 * yScale;

            CorrectAnswerPointsTextBlock.FontSize = 12 * yScale;
            CorrectPointsTextBox.FontSize         = 12 * yScale;
            CorrectPointsOkButton.FontSize        = 12 * yScale;
            CorrectPointsCancelButton.FontSize    = 12 * yScale;

            WrongPointsTextBlock.FontSize    = 12 * yScale;
            WrongPointsTextBox.FontSize      = 12 * yScale;
            WrongPointsOkButton.FontSize     = 12 * yScale;
            WrongPointsCancelButton.FontSize = 12 * yScale;

            QuestionTimerTextBlock.FontSize    = 12 * yScale;
            QuestionTimerTextBox.FontSize      = 12 * yScale;
            QuestionTimerOkButton.FontSize     = 12 * yScale;
            QuestionTimerCancelButton.FontSize = 12 * yScale;

            ControlsTextBlock.FontSize        = 12 * yScale;
            ControlsExplainTextBlock.FontSize = 12 * yScale;
            ControlsOkButton.FontSize         = 12 * yScale;

            AboutTextBlock.FontSize = 12 * yScale;
            AboutOkButton.FontSize  = 12 * yScale;

            FailedTextBlock.FontSize       = 16 * yScale;
            FailedReasonTextBlock.FontSize = 12 * yScale;
            FailedOkButton.FontSize        = 12 * yScale;

            ParticleGenerator.setScale(xScale, yScale);
            QuizControl.setScale(xScale, yScale);
            TeamKPlayerControl.resize(xScale, yScale);
            Team1PlayerControl.resize(xScale, yScale);
            Team2PlayerControl.resize(xScale, yScale);
            Team3PlayerControl.resize(xScale, yScale);
            Team4PlayerControl.resize(xScale, yScale);

            InvalidateArrange();
        }
Example #3
0
        // _________________________________ CLASS METHODS _________________________________

        public frmTeamSelect(QuizControl Control)
        {
            this.InitializeComponent();

            // maak referentie van het quizcontrol object
            _control = Control;

            // zet waardes in de labels
            this.lblTeamA.Text = _control.TeamA.Naam;
            this.lblTeamB.Text = _control.TeamB.Naam;
            this.lblTeamC.Text = _control.TeamC.Naam;

            this.lblPuntenTeamA.Text = _control.TeamA.Punten.ToString();
            this.lblPuntenTeamB.Text = _control.TeamB.Punten.ToString();
            this.lblPuntenTeamC.Text = _control.TeamC.Punten.ToString();
        }
Example #4
0
 private void Jump_Popup_Ok_Clicked(object sender, EventArgs e)
 {
     JumpToFinalQuestionPopup.IsOpen = false;
     QuizControl.jumpToFinalQuestion();
 }
Example #5
0
 public void closeQuiz()
 {
     QuizControl.close();
     CloseQuizMenuItem.IsEnabled           = false;
     JumpToFinalQuestionMenuItem.IsEnabled = false;
 }
Example #6
0
        protected void gvQuestions_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            int quizResultId = Convert.ToInt32(Session["ResultId"]);

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                QuizControl qc = new QuizControl();

                Label lblQuestionId    = (Label)e.Row.FindControl("lblQuestionId");
                Label lblRightWrong    = (Label)e.Row.FindControl("lblRightWrong");
                Label lblYourAnswer    = (Label)e.Row.FindControl("lblYourAnswer");
                Label lblCorrectAnswer = (Label)e.Row.FindControl("lblCorrectAnswer");

                int questionId = Convert.ToInt32(lblQuestionId.Text);


                lblYourAnswer.Text    = qc.GetOwnAnswer(questionId, quizResultId);
                lblCorrectAnswer.Text = qc.GetCorrectAnswer(questionId);

                if (lblYourAnswer.Text == lblCorrectAnswer.Text)
                {
                    lblRightWrong.ForeColor = System.Drawing.Color.Green;
                    lblRightWrong.Text      = "Correct! 正确!";
                    correctCount++;
                }

                else if (lblYourAnswer.Text == null || lblYourAnswer.Text == "")
                {
                    lblYourAnswer.Visible    = false;
                    lblCorrectAnswer.Visible = false;
                    lblRightWrong.ForeColor  = System.Drawing.Color.Red;
                    lblRightWrong.Text       = "Cannot mark. This question might have been added after your quiz attempt. - 不能标记. 您的测验尝试后可能会添加此问题。";
                }

                else
                {
                    lblRightWrong.ForeColor = System.Drawing.Color.Red;
                    lblRightWrong.Text      = "Incorrect! 不正确!";
                    incorrectCount++;
                }

                decimal percentage = 100 * correctCount / (correctCount + incorrectCount);
                lblScore.Text = percentage.ToString() + "%";
                if (percentage >= 80)
                {
                    lblScore.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblScore.ForeColor = System.Drawing.Color.Red;
                }

                QuizResult qr = context.QuizResults.Where(x => x.ResultId == quizResultId).First();
                //if (qr.Correct == null || qr.Incorrect == null || qr.Result == null)
                //{
                qr.Correct   = correctCount;
                qr.Incorrect = incorrectCount;
                if (percentage >= 80)
                {
                    qr.Result = "Pass - 通过";
                }
                else
                {
                    qr.Result = "Fail - 失败";
                }
                context.SaveChanges();
                //}
            }
        }