private void btnCreateConfirm_Tapped(object sender, TappedRoutedEventArgs e) { QuestAnsViewModel t = new QuestAnsViewModel(); t.Text = txtAddNewAnswer.Text;; t.Index = display.Count + 1; //If possible answer is in correct answer, checkbox to true //Add holder into list<> display display.Add(t); UpdateChanges(); Frame.Navigate(typeof(QuestionDetail), selected); }
public void DisplayQuestion() { tbkQuestion.Text = gameQuest[index].QuestionText; display.Clear(); var options = gameQuest[index].OptionsText.Split('|'); //var possibleAnswers = gameQuest[index].AnswerText.Split('|'); //Loop through possible answers for (int i = 0; i < options.Length; i++) { //place them in holder and set variables QuestAnsViewModel t = new QuestAnsViewModel(); t.Text = options[i]; display.Add(t); } gameplayView.ItemsSource = display; }
private void AnswerSelectionList_ItemClick(object sender, ItemClickEventArgs e) { var s = (Answer)e.ClickedItem; QuestAnsViewModel t = new QuestAnsViewModel(); t.Text = s.Text; t.Index = display.Count + 1; //If selected answer has an image. if (s.AnswerPictures.Count() != 0) { //get the image and adds it to the view model var p = s.AnswerPictures.ToList(); Picture picture = picRepo.GetPicture(p[0].PictureID); t.Image = imageConverter.ByteToImage(picture.Image); t.ImageID = picture.ID.ToString(); } //Add holder into list<> display display.Add(t); UpdateChanges(); Frame.Navigate(typeof(QuestionDetail), selected); }
public void PopulateModelAnswerList() { //if question has images if (selected.OptionsText != null && selected.AnswerText != null && selected.ImageIDs != "") { //Splits question's details in their own list var options = selected.OptionsText.Split('|'); var possibleAnswers = selected.AnswerText.Split('|'); var images = selected.ImageIDs.Split('|'); //Loop through possible answers for (int i = 0; i < options.Length; i++) { //place them in holder and set variables QuestAnsViewModel t = new QuestAnsViewModel(); t.Text = options[i]; t.Index = i; //If possible answer is in correct answer, checkbox to true if (possibleAnswers.Contains(options[i])) { t.IsTrue = true; } if (images[i] != "0") { //gets the image for the question and puts it in the view model Picture pic = picRepo.GetPicture(Convert.ToInt32(images[i])); t.Image = imageConverter.ByteToImage(pic.Image); t.ImageID = images[i]; } display.Add(t); } } //if question doesn't have images else if (selected.OptionsText != null && selected.AnswerText != null) { //Splits question's details in their own list var options = selected.OptionsText.Split('|'); var possibleAnswers = selected.AnswerText.Split('|'); //Loop through possible answers for (int i = 0; i < options.Length; i++) { //place them in holder and set variables QuestAnsViewModel t = new QuestAnsViewModel(); t.Text = options[i]; t.Index = i; //If possible answer is in correct answer, checkbox to true if (possibleAnswers.Contains(options[i])) { t.IsTrue = true; } } } AnswerList.ItemsSource = display; var list = new List <Answer>(); list = ansRepo.GetAnswerSelection(); AnswerSelectionList.ItemsSource = list; }