Beispiel #1
0
                public static void CreateButtonsEvents()
                {
                    LeftButton.Click += (s, e) =>
                    {
                        QuestionPath.SelectAnswer(AnswerType.Left);

                        if (QuestionPath.NextQuestion())
                        {
                            Render(QuestionPath.CurrentQuestion);
                        }
                        else
                        {
                            IsTestFinished = true;
                            Test.Release();
                            PostScreen.Render();
                        }
                    };
                    RightButton.Click += (s, e) =>
                    {
                        QuestionPath.SelectAnswer(AnswerType.Right);

                        if (QuestionPath.NextQuestion())
                        {
                            Render(QuestionPath.CurrentQuestion);
                        }
                        else
                        {
                            IsTestFinished = true;
                            Test.Release();
                            PostScreen.Render();
                        }
                    };
                }
Beispiel #2
0
        public static void StartTest(IEnumerable <Question> questions)
        {
            if (IsTestFinished)
            {
                if (QuestionPath == null)
                {
                    QuestionPath = QuestionPath.Create(questions);
                }
                else
                {
                    QuestionPath.Reset();
                }
                Renderer.PostScreen.Release();
                Renderer.Test.Render(QuestionPath.CurrentQuestion);

                IsTestFinished = false;
            }
        }
Beispiel #3
0
        public static void StartTest(QuestionPath questionPath)
        {
            if (IsTestFinished)
            {
                if (QuestionPath == null)
                {
                    QuestionPath = questionPath;
                }
                else
                {
                    QuestionPath.Reset();
                }
                Renderer.PostScreen.Release();
                Renderer.Test.Render(QuestionPath.CurrentQuestion);

                IsTestFinished = false;
            }
        }
Beispiel #4
0
        public SolutionPathForm(QuestionPath questionPath)
        {
            InitializeComponent();
            Text = "Выберите вопрос и интересующий результат";

            cumboBox1.Items.AddRange(questionPath.QuestionList.Select(item => item.QuestionText).ToArray());
            cumboBox1.SelectedIndex = 0;
            cumboBox2.Items.AddRange(QuestionPath.TestRank.ToArray());
            cumboBox2.SelectedIndex = 0;

            button1.Click += (s, e) =>
            {
                var question   = questionPath.GetQuestion((String)cumboBox1.SelectedItem);
                var path       = questionPath.PathToSolution(question, (String)cumboBox2.SelectedItem);
                var rank       = QuestionPath.TestRank.IndexesWhere(x => x == (String)cumboBox2.SelectedItem).First();
                var editedPath = path.Select((item, index) => $"{(index < rank ? $"{item.QuestionText}\n{item.RightAnswerText}" : $"{item.QuestionText}\n{item.WrongAnswetText}")}");

                MessageBox.Show
                (
                    $"Путь к решению '{(String)cumboBox2.SelectedItem}'\n\n" +
                    editedPath.AsIndentedString("\n\n")
                );
            };
Beispiel #5
0
                public static void InitializeComponents()
                {
                    ResultLabel.Dock      = DockStyle.Fill;
                    ResultLabel.Font      = new System.Drawing.Font("Calibri Light", 10);
                    ResultLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

                    var pathList = QuestionPath.QuestionPathList.Select(item => $"{item.QuestionText}\n{(item.ChosenAnswer == item.RightAnswer ? $":: {item.ChosenAnswerText} ::" : item.ChosenAnswerText)}");

                    ResultLabel.Text = $"Ваш счёт: {QuestionPath.TotalScore}\n" +
                                       $"{(QuestionPath.TotalScore == 7 ? $"Вы уже настолько преисполнились..." : $"Вы – {QuestionPath.WhoAmI()}")}\n\n" +
                                       $"Ваши ответы: \n\n" +
                                       $"{pathList.AsIndentedString("\n\n")}";

                    if (!ControlCollection.Contains(ResultLabel))
                    {
                        ControlCollection.Add(ResultLabel);
                    }
                }