Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.QuizLayout);
            DBStore dBStore = new DBStore();

            Category = Intent.GetStringExtra("Category");
            Enum.TryParse(Category, out QuizCategory category);
            //Pull Data from database
            List <Quiz> CompleteQuizlist = dBStore.GetQuizList();                     //Extract questions from database

            ChosenList = CurrentQuestion.GetQuizCategory(CompleteQuizlist, category); //Pass into second list with category selected
            ChosenList = CurrentQuestion.PullXRandomQuestions(5, ChosenList);         //
            Question   = ChosenList[0];
            #region LayoutWireUP
            txtQuestion      = FindViewById <TextView>(Resource.Id.txtQuestion);
            rbAnswer1        = FindViewById <RadioButton>(Resource.Id.radioAnswer1);
            rbAnswer2        = FindViewById <RadioButton>(Resource.Id.radioAnswer2);
            rbAnswer3        = FindViewById <RadioButton>(Resource.Id.radioAnswer3);
            btnSubmitAnswer  = FindViewById <Button>(Resource.Id.btnSubmitAnswer);
            radioAnswerGroup = FindViewById <RadioGroup>(Resource.Id.radioAnswerGroup);
            wrongAnswerSound = MediaPlayer.Create(this, Resource.Raw.WrongAnswer);
            rightAnswerSound = MediaPlayer.Create(this, Resource.Raw.RightAnswer);
            finishQuizSound  = MediaPlayer.Create(this, Resource.Raw.FinishQuiz);
            lblQuestionCount = FindViewById <TextView>(Resource.Id.lblQuestionCount);
            lblScore         = FindViewById <TextView>(Resource.Id.lblScore);
            #endregion
            txtQuestion.Text = Question.Question;
            RandomiseButtons(Question);
            btnSubmitAnswer.Click += BtnSubmitAnswer_Click;
        }
        private void PopulateList()
        {//Access database to populate list
            DBStore quizDB = new DBStore();

            Quizlist = quizDB.GetQuizList();
        }