private void resultTimerCallback(object state)
        {
            this.resultTimer.Dispose();
            this.resultTimer = null;

            this.Dispatcher.BeginInvoke(new ThreadStart(() =>
            {
                ResultInfoUserControl resultControl = new ResultInfoUserControl();
                resultControl.State = ResultState.Pass;
                resultControl.ResultInfoCompleted += (object sender, EventArgs e) =>
                {
                    this.Next();
                };
                GC_UIHelper.ShowMessageWindow(resultControl);
            }),
                                        DispatcherPriority.Background,
                                        null);
        }
Beispiel #2
0
        private void ShowResult()
        {
            this.currentPage = 0;
            this.totalPage   = this.questionData.Items.Count / questonCountPerPage;
            if (this.questionData.Items.Count % questonCountPerPage != 0)
            {
                this.totalPage++;
            }

            //   this.countPerPageLabel.Content = string.Format(SoonLearning.Math.Fast.Properties.Resources.questionCountPerPage, questonCountPerPage);
            this.UpdatePageInfo();

            int i = 0;

            foreach (Question_a_b_c_ResultControl ctrl in this.questionGrid.Children)
            {
                if (i >= this.questionData.Items.Count)
                {
                    break;
                }

                ctrl.DataContext = this.questionData.Items[i++];
                if (i == questonCountPerPage)
                {
                    break;
                }
            }

            int correct   = 0;
            int incorrect = 0;
            int noAnswer  = 0;

            foreach (Question_a_b_c q in questionData.Items)
            {
                if (q.IsCorrect == null)
                {
                    noAnswer++;
                }
                else if (!q.IsCorrect.Value)
                {
                    incorrect++;
                }
                else
                {
                    correct++;
                }
            }

            this.correctResultLabel.Content   = string.Format(SoonLearning.Math.Fast.Properties.Resources.Corrrent, correct);
            this.incorrectResultLabel.Content = string.Format(SoonLearning.Math.Fast.Properties.Resources.InCorrect, incorrect);
            this.noAnswerResultLabel.Content  = string.Format(SoonLearning.Math.Fast.Properties.Resources.NoAnswer, noAnswer);

            this.scoreLabel.Content = string.Format(SoonLearning.Math.Fast.Properties.Resources.Score, this.questionData.Score);

            ResultInfoUserControl resultControl = new ResultInfoUserControl();

            resultControl.Visibility = System.Windows.Visibility.Visible;
            if (this.questionData.MaxNumber == correct)
            {
                resultControl.State = ResultState.Perfect;
            }
            else if (this.questionData.PassQuizCorrectCount <= correct)
            {
                resultControl.State = ResultState.Pass;
            }
            else
            {
                resultControl.State = ResultState.NotPass;
            }
            resultControl.Show = true;
        }