Exemplo n.º 1
0
        public FormTanuloKornyezetismeret()
        {
            InitializeComponent();

            this.answerButtons    = new Button[AnswerButtonCount];
            this.answerButtons[0] = this.answerButton1;
            this.answerButtons[1] = this.answerButton2;
            this.answerButtons[2] = this.answerButton3;
            this.answerButtons[3] = this.answerButton4;

            EnvironmentalQuestionsManager manager = new EnvironmentalQuestionsManager();

            this.list            = manager.SelectAll();
            this.currentQuestion = 0;

            Action <object, MouseEventArgs> answerClicked = (obj, e) =>
            {
                int correctIndex = this.list[this.currentQuestion].Answers.FindIndex((x) => x.IsCorrect);
                if (obj.Equals(this.answerButtons[correctIndex]))
                {
                    //Jó válasz
                    User.CurrentUser.Score += this.list[this.currentQuestion].Score;
                }
                else
                {
                    //Helytelen válasz
                    MessageBox.Show("Helytelen válasz!", "HIBA", MessageBoxButtons.OK);
                }

                this.GetNextQuestion();
            };
        }