Ejemplo n.º 1
0
        private void AnswerOpen_Click(object sender, RoutedEventArgs e)
        {
            if (iterator.Current().CheckAnswer(Answer_Eng.Text))
            {
                test.IncreasePoints();
            }

            if (iterator.HasNext())
            {
                Question question = iterator.Next();
                if (way == "pol->ang")
                {
                    question = new HintPolish(question, Database.GetPolishHint(question.ID));
                }
                else
                {
                    question = new HintEnglish(question, Database.GetEnglishHint(question.ID));
                    question.ChangeSolvingWay();
                }
                //sprawdzić czy działa
                Polish.ToolTip     = (question as Hint).GetHint();
                Polish.Content     = question.question;
                PolishOpen.Content = question.question;
                Answer_Eng.Text    = String.Empty;
            }
            else
            {
                MessageBox.Show(test.GetResult().ToString() + " / 10", "Wynik testu");
                Database.SaveHistory(user.GetID(), test.ToString());
            }
        }
Ejemplo n.º 2
0
 private void Next_Click(object sender, RoutedEventArgs e)
 {
     if (canNext)
     {
         answerBox.Text = String.Empty;
         if (iterator.HasNext())
         {
             Question question = (Question)iterator.Next();
             if (way == "pol->ang")
             {
                 questionLabel.Content = question.question;
                 question = new HintPolish(question, Database.GetPolishHint(question.ID));
             }
             else
             {
                 questionLabel.Content = question.answer;
                 question = new HintEnglish(question, Database.GetEnglishHint(question.ID));
             }
             questionLabel.ToolTip = (question as HintPolish).GetHint();
         }
         else
         {
             ConcreteAggregate concreteAggregate = new ConcreteAggregate();
             concreteAggregate.AddQuestions(test.questionChooseStrategy.GetQuestions("write", test.level.Nubmer));
             iterator = concreteAggregate.CreateIterator(3);
         }
         canNext = false;
     }
     else
     {
         MessageBox.Show("You can't go further.");
     }
     checkBtn.Background = Brushes.LightGray;
 }
Ejemplo n.º 3
0
        private void Answer_Click(object sender, RoutedEventArgs e)
        {
            if (iterator.Current().CheckAnswer(selected_closed))
            {
                test.IncreasePoints();
            }

            if (iterator.HasNext())
            {
                Question question = iterator.Next();
                if (way == "pol->ang")
                {
                    question = new HintPolish(question, Database.GetPolishHint(question.ID));
                }
                else
                {
                    question.ChangeSolvingWay();
                    question = new HintEnglish(question, Database.GetEnglishHint(question.ID));
                }
                //sprawdzić czy działa
                Polish.ToolTip = (question as Hint).GetHint();
                Polish.Content = question.question;
                if (way == "pol->ang")
                {
                    (iterator.Current() as CloseQuestion).GetWrongAnswers(false, test.level.Nubmer + 1, test.level.Nubmer);
                }
                else
                {
                    (iterator.Current() as CloseQuestion).GetWrongAnswers(true, test.level.Nubmer + 1, test.level.Nubmer);
                } PopulateClosedAnswers((iterator.Current() as CloseQuestion).wrongAnswers);
                Polish.Content = question.question;
            }
            else
            {
                MessageBox.Show(test.GetResult().ToString() + " / 10", "Wynik testu");
                Database.SaveHistory(user.GetID(), test.ToString());
            }
        }
Ejemplo n.º 4
0
        public StudyModeWindow(ref User user)
        {
            InitializeComponent();
            command = new TestMode(user);
            command.Execute();
            var      tmp     = random.Next(1, 4);
            IBuilder builder = new TestOpenBuilder(
                tmp == 1 ? new FactoryVeryEasy() :
                tmp == 2 ? new FactoryEasy() :
                tmp == 3 ? new FactoryNormal() : new FactoryHard() as AbstractFactory,
                "random");

            user.MakeNewTest(builder);
            test             = builder.PrintTest();
            LvlLabel.Content = test.level.ToString();

            ConcreteAggregate concreteAggregate = new ConcreteAggregate();

            concreteAggregate.AddQuestions(test.questionChooseStrategy.GetQuestions("write", test.level.Nubmer));
            iterator = concreteAggregate.CreateIterator(3);

            if (iterator.HasNext())
            {
                Question question = (Question)iterator.Next();
                if (way == "pol->ang")
                {
                    questionLabel.Content = question.question;
                    question = new HintPolish(question, Database.GetPolishHint(question.ID));
                }
                else
                {
                    questionLabel.Content = question.answer;
                    question = new HintEnglish(question, Database.GetEnglishHint(question.ID));
                }
                questionLabel.ToolTip = (question as HintPolish).GetHint();
            }
        }
Ejemplo n.º 5
0
        private void Run_Test(object sender, RoutedEventArgs e)
        {
            command.Execute();
            OptionGrid.Visibility = Visibility.Collapsed;

            if (type == "Otwarty")
            {
                IBuilder builder = new TestOpenBuilder(
                    skill == "Bardzo łatwy" ? new FactoryVeryEasy() :
                    skill == "Łatwy" ? new FactoryEasy() :
                    skill == "Średni" ? new FactoryNormal() : new FactoryHard() as AbstractFactory,
                    strategy);
                user.MakeNewTest(builder);
                this.test       = builder.PrintTest();
                Open.Visibility = Visibility.Visible;
                ConcreteAggregate concreteAggregate = new ConcreteAggregate();
                concreteAggregate.AddQuestions(test.questionChooseStrategy.GetQuestions("write", test.level.Nubmer));
                iterator = concreteAggregate.CreateIterator(random.Next(3));

                if (iterator.HasNext())
                {
                    Question question = iterator.Next();
                    if (way == "pol->ang")
                    {
                        question           = new HintPolish(question, Database.GetPolishHint(question.ID));
                        PolishOpen.ToolTip = (question as HintPolish).GetHint();
                    }
                    else
                    {
                        question.ChangeSolvingWay();
                        question           = new HintEnglish(question, Database.GetEnglishHint(question.ID));
                        PolishOpen.ToolTip = (question as HintEnglish).GetHint();
                    }
                    PolishOpen.Content = question.question;
                }
            }
            else if (type == "Zamkniety")
            {
                IBuilder builder = new TestCloseBuilder(
                    skill == "Bardzo łatwy" ? new FactoryVeryEasy() :
                    skill == "Łatwy" ? new FactoryEasy() :
                    skill == "Średni" ? new FactoryNormal() : new FactoryHard() as AbstractFactory,
                    strategy);
                user.MakeNewTest(builder);
                this.test       = builder.PrintTest();
                Test.Visibility = Visibility.Visible;
                ConcreteAggregate concreteAggregate = new ConcreteAggregate();
                concreteAggregate.AddQuestions(test.questionChooseStrategy.GetQuestions("single", test.level.Nubmer));
                iterator = concreteAggregate.CreateIterator(random.Next(3));

                if (iterator.HasNext())
                {
                    Question question = iterator.Next();

                    if (way == "pol->ang")
                    {
                        question       = new HintPolish(question, Database.GetPolishHint(question.ID));
                        Polish.ToolTip = (question as HintPolish).GetHint();
                    }
                    else
                    {
                        question.ChangeSolvingWay();
                        question       = new HintEnglish(question, Database.GetEnglishHint(question.ID));
                        Polish.ToolTip = (question as HintEnglish).GetHint();
                    }

                    if (way == "pol->ang")
                    {
                        (iterator.Current() as CloseQuestion).GetWrongAnswers(false, test.level.Nubmer + 1, test.level.Nubmer);
                    }
                    else
                    {
                        (iterator.Current() as CloseQuestion).GetWrongAnswers(true, test.level.Nubmer + 1, test.level.Nubmer);
                    }
                    PopulateClosedAnswers((iterator.Current() as CloseQuestion).wrongAnswers);
                    Polish.Content = question.question;
                }
            }
        }