private void DistributeData() { PageList = new List <object>(); foreach (var i in Contents) { if (i.type.ToString().Equals("mcq")) { Models.Mcq q = new Models.Mcq { Question = i.content.Question, Answers = i.content.Answers, CorrectAnswer = i.content.CorrectAnswer }; PageList.Add(q); } if (i.type.ToString().Equals("cloze")) { Cloze c = new Cloze { Sentence = i.content.sentence, MissingWords = i.content.MissingWords }; PageList.Add(c); } } }
private void DoTransition() { question = Questions[index]; QuestionLbl.Text = question.Question; choices = CallBackChoices(question); CreateButtons(); }
private string[] CallBackChoices(Models.Mcq question) { string[] Choices = new string[question.Answers.Count]; for (int i = 0; i < question.Answers.Count; i++) { Choices[i] = question.Answers[i]; } return(Choices); }
private void RefreshButtons(Models.Mcq question) { choices = CallBackChoices(question); for (int i = 0; i < choices.Length; i++) { Btns[i].Text = choices[i]; } }
private void ShowQuestion(Object page) { Question = (Models.Mcq)page; QuestionLbl = new Label { Text = Question.Question, Padding = 35, TextColor = Color.Black }; MyLayout.Children.Add(QuestionLbl); choices = CallBackChoices(Question); CreateMcqAnswerBtn(); MyLayout.Children.Add(SubmitBtn); }
private void BtnAction(object sender, EventArgs e) { Button b = (Button)sender; if (b.Text.Equals(question.CorrectAnswer)) { Console.WriteLine("Correct"); index++; question = Questions[index]; QuestionLbl.Text = question.Question; RefreshButtons(question); } }
private void ModifyData() { Questions = new List <Models.Mcq>(); for (int i = 0; i < Contents.Count; i++) { Models.Mcq q = new Models.Mcq(); //q.Question = Contents[i].Question; //q.Answers = Contents[i].Answers; //q.CorrectAnswer = Contents[i].CorrectAnswer; Questions.Add(q); } Console.WriteLine(Questions.Count); }