Exemplo n.º 1
0
        private void ShowNext()
        {
            txtAnswer.Text = "";
            if (_hanziRecognizer != null)
            {
                _hanziRecognizer.Clear();
                lstResults.Items.Clear();
            }
            if (_questionNumber + 1 <= _questionResult.Count || (_mode == QuizzMode.Intensive && _unresolved.Count > 0))
            {
                if (_questionNumber + 1 <= _questionResult.Count)
                    currentQuestion = _questionResult[++_questionNumber - 1];
                else
                    currentQuestion = _unresolved.Dequeue();
                currentQuestion.AttemptCount++;
                if (_mode == QuizzMode.Intensive)
                    lblQuestionNumber.Text = currentQuestion.QuestionNumber + " / " + _questionResult.Count + " - " + Resources.Attempt + " " + currentQuestion.AttemptCount;
                else
                    lblQuestionNumber.Text = _questionNumber + " / " + _questionResult.Count;
                if (currentQuestion.Settings is TextSettings)
                {
                    TextSettings settings = currentQuestion.Settings as TextSettings;
                    lblContent.Font = settings.Font;
                    lblContent.BackColor = settings.BackgroundColor;
                    lblContent.ForeColor = settings.FontColor;
                    lblContent.Text = (string)currentQuestion.Question;
                    lblContent.Show();
                    picContent.Hide();
                }
                if (currentQuestion.Settings is ImageSettings)
                {
                    ImageSettings settings = currentQuestion.Settings as ImageSettings;
                    picContent.Image = FileManager.ByteArrayToImage((byte[])currentQuestion.Question);
                    picContent.SizeMode = settings.SizeMode;
                    picContent.BackColor = settings.BackgroundColor;
                    lblContent.Hide();
                    picContent.Show();

                }
                
                tabExam.SelectedIndex = 0;
            }
            else
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Exemplo n.º 2
0
        public override void ReceiveAllData(List<Content> content)
        {
            DialogResult finalResult = DialogResult.Abort;

            if (content.Count < 1)
                InvokeStoppedEvent(null);
            _frmStart = new FrmStart();
            _frmStart.lblQuestionNumber.Text = content.Count.ToString();
            _frmStart.numMaxQuestions.Maximum = content.Count;
            bool questionChoosen = false;
            foreach (ContentElement element in content[0].Elements)
            {
                if (element.Type == ContentType.Text || element.Type == ContentType.Image)
                {
                    _frmStart.cboQuestionConcern.Items.Add(element.Name);
                    if (element.Type == ContentType.Text)
                        _frmStart.cboAnswerConcern.Items.Add(element.Name);
                    if (!questionChoosen)
                    {
                        _frmStart.cboQuestionConcern.Text = element.Name;
                        questionChoosen = true;
                    }
                    if (element.Type == ContentType.Text)
                        _frmStart.cboAnswerConcern.Text = element.Name;
                }
            }
            if (_frmStart.ShowDialog() == DialogResult.OK)
            {
                List<QuestionResult> questionResult = new List<QuestionResult>();
                if (_frmStart.chkMaxQuestions.Checked)
                    content.RemoveRange((int)_frmStart.numMaxQuestions.Value, content.Count - (int)_frmStart.numMaxQuestions.Value);
                int num = 0;
                foreach (Content current in content)
                {
                    QuestionResult newQuestion = new QuestionResult();
                    newQuestion.QuestionNumber = ++num;
                    newQuestion.ContentIndex = current.Index;
                    newQuestion.AnswerContentType = GetElementFromName(current.Elements, _frmStart.cboAnswerConcern.SelectedItem).Type;
                    newQuestion.GoodAnswer = GetElementFromName(current.Elements, _frmStart.cboAnswerConcern.SelectedItem).Data;
                    newQuestion.QuestionContentType = GetElementFromName(current.Elements, _frmStart.cboQuestionConcern.SelectedItem).Type;
                    newQuestion.Question = GetElementFromName(current.Elements, _frmStart.cboQuestionConcern.SelectedItem).Data;
                    newQuestion.Settings = GetElementFromName(current.Elements, _frmStart.cboQuestionConcern.SelectedItem).Settings;
                    questionResult.Add(newQuestion);
                }
                if (_frmStart.chkWritingRecognition.Checked)
                {
                    QuizzSettings.Default.WritingRecognitionLanguage =
                        (CultureInfo)_frmStart.cboWritingLanguage.SelectedItem;
                    QuizzSettings.Default.WritingRecognition = true;
                }
                else
                    QuizzSettings.Default.WritingRecognition = false;
                if (_frmStart.rdoIntensive.Checked)
                    _mode = QuizzMode.Intensive;
                else
                    _mode = QuizzMode.Exam;
                
                _frmTwik = new FrmQuizz(_mode, questionResult, _frmStart.chkWritingRecognition.Checked, (CultureInfo)_frmStart.cboWritingLanguage.SelectedItem);
                _frmStart = null;
                if (_frmTwik.ShowDialog() == DialogResult.OK)
                {
                    _frmTwik = null;
                    _frmResult = new FrmResult(_mode, _core, questionResult);
                    finalResult = _frmResult.ShowDialog();
                    _frmResult = null;
                }
            }
            InvokeStoppedEvent(null);
            if (finalResult == DialogResult.Retry)
                ReceiveAllData(content);
            else if (finalResult == DialogResult.Yes)
                InvokeWaitForAllDataEvent(null);
            _core.WakeUp();
        }
Exemplo n.º 3
0
 public FrmAnswer(QuestionResult question)
 {
     InitializeComponent();
     lblAnswer.Text = question.GoodAnswer as String;
 }