Exemplo n.º 1
0
        private void StaertTest_Click(object sender, RoutedEventArgs e)
        {
            StateType stateType = _answerCheker.CheckQuestion(new TestAnswerEntity()
            {
                AllCount = _questionEntities.Count,
                Answer   = new BaseValue()
                {
                    Value = Answer.Text
                },
                CurrentCount   = number,
                NameTest       = QuestionType.ModuleCodeQ.ToString(),
                QuestionEntity = _currentQuestionEntity
            }).Data;

            _currentQuestionEntity = _questionEntities
                                     .FirstOrDefault(p => p.StateType == StateType.Default);
            Answer.Text = null;
            if (_currentQuestionEntity != null)
            {
                DescriptionText.Text = _currentQuestionEntity?.Description;
                QuestionText.Text    = _currentQuestionEntity?.Question.Value;
                number++;
                Number.Text  = number.ToString();
                Correct.Text = $"{_questionEntities.Count(p => p.StateType == StateType.Corect)}/{_questionEntities.Count}";
            }
            else
            {
                JsonParser <IQuestionEntity> .SaveList.Clear();

                _grid.Children.Clear();
                _grid.Children.Add(new ResultView(_grid, this));
            }
        }
        private void StaertTest_Click(object sender, RoutedEventArgs e)
        {
            MatrixValue matrix = (MatrixValue)_currentQuestionEntity.Question;


            string[][] answer = null;

            if (_currentQuestionEntity.CodeType == CodeType.Encoding)
            {
                answer    = new string[1][];
                answer[1] = new string[_textAnswer.Count];
                for (int i = 0; i < _textAnswer.Count; i++)
                {
                    answer[1][i] = _textAnswer[i].Text;
                }
            }
            else
            {
                answer = new string[_textAnswer.Count][];

                for (int i = 0; i < _textAnswer.Count; i++)
                {
                    answer[i]    = new string[1];
                    answer[i][1] = _textAnswer[i].Text;
                }
            }

            StateType stateType = _answerCheker.CheckQuestion(new TestAnswerEntity()
            {
                AllCount = _questionEntities.Count,
                Answer   = new MatrixValue()
                {
                    Matrix = answer
                },
                CurrentCount   = number,
                NameTest       = QuestionType.RidaMallera.ToString(),
                QuestionEntity = _currentQuestionEntity
            }).Data;

            _currentQuestionEntity = _questionEntities
                                     .FirstOrDefault(p => p.StateType == StateType.Default);

            if (_currentQuestionEntity != null)
            {
                InitMatrix();
                DescriptionText.Text = _currentQuestionEntity?.Description;

                number++;
                Number.Text  = number.ToString();
                Correct.Text = $"{_questionEntities.Count(p => p.StateType == StateType.Corect)}/{_questionEntities.Count}";
            }
            else
            {
                _grid.Children.Clear();
                _grid.Children.Add(new ResultView(_grid, this));
            }
        }
Exemplo n.º 3
0
        private void StaertTest_Click(object sender, RoutedEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var s in _textAnswer)
            {
                sb.Append(s.Text);
            }
            StateType stateType = _answerCheker.CheckQuestion(new TestAnswerEntity()
            {
                AllCount = _questionEntities.Count,
                Answer   = new BaseValue()
                {
                    Value = sb.ToString()
                },
                CurrentCount   = number,
                NameTest       = QuestionType.Ellieas.ToString(),
                QuestionEntity = _currentQuestionEntity
            }).Data;

            _currentQuestionEntity = _questionEntities
                                     .FirstOrDefault(p => p.StateType == StateType.Default);

            if (_currentQuestionEntity != null)
            {
                InitMatrix();
                DescriptionText.Text = _currentQuestionEntity?.Description;

                number++;
                Number.Text  = number.ToString();
                Correct.Text = $"{_questionEntities.Count(p => p.StateType == StateType.Corect)}/{_questionEntities.Count}";
            }
            else
            {
                JsonParser <IQuestionEntity> .SaveList.Clear();

                _grid.Children.Clear();
                _grid.Children.Add(new ResultView(_grid, this, _name));
            }
        }
Exemplo n.º 4
0
        private void StaertTest_Click(object sender, RoutedEventArgs e)
        {
            MatrixValue matrix = (MatrixValue)_currentQuestionEntity.Question;

            string[][] answer = new string[matrix.Matrix.Length + 1][];
            int        k      = 0;

            for (int i = 0; i < matrix.Matrix.Length + 1; i++)
            {
                if (i == matrix.Matrix.Length)
                {
                    answer[i] = new string[_textAnswer.Count - k];

                    for (int l = k; l < _textAnswer.Count; l++)
                    {
                        answer[i][l - k] = _textAnswer[l].Text;
                    }
                }
                else
                {
                    answer[i] = new string[matrix.Matrix[i].Length + 1];

                    for (int j = 0; j < matrix.Matrix[i].Length + 1; j++)
                    {
                        if (i < matrix.Matrix.Length &&
                            j < matrix.Matrix[i].Length)
                        {
                            answer[i][j] = matrix.Matrix[i][j];
                        }
                        else if (i != j && (matrix.Matrix.Length == i ||
                                            matrix.Matrix.Length == j))
                        {
                            answer[i][j] = _textAnswer[k].Text;
                            k++;
                        }
                    }
                }
            }

            StateType stateType = _answerCheker.CheckQuestion(new TestAnswerEntity()
            {
                AllCount = _questionEntities.Count,
                Answer   = new MatrixValue()
                {
                    Matrix = answer
                },
                CurrentCount   = number,
                NameTest       = QuestionType.Iterative.ToString(),
                QuestionEntity = _currentQuestionEntity
            }).Data;

            _currentQuestionEntity = _questionEntities
                                     .FirstOrDefault(p => p.StateType == StateType.Default);

            if (_currentQuestionEntity != null)
            {
                InitMatrix();
                DescriptionText.Text = _currentQuestionEntity?.Description;

                number++;
                Number.Text  = number.ToString();
                Correct.Text = $"{_questionEntities.Count(p => p.StateType == StateType.Corect)}/{_questionEntities.Count}";
            }
            else
            {
                _grid.Children.Clear();
                _grid.Children.Add(new ResultView(_grid, this));
            }
        }