Exemplo n.º 1
0
 public TestView(ref User user)
 {
     InitializeComponent();
     this.user = user;
     command   = new TestMode(user);
     random    = new Random();
 }
Exemplo n.º 2
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();
            }
        }