public void Add(string question, string correctAnswerText, string incorrectAnswerText1, string incorrectAnswerText2, string incorrectAnswerText3) { Answer correctAnswer = new Answer() { Text = correctAnswerText }; Answer incorrectAnswer1 = new Answer() { Text = incorrectAnswerText1, IsCorrect = false}; Answer incorrectAnswer2 = new Answer() { Text = incorrectAnswerText2, IsCorrect = false}; Answer incorrectAnswer3 = new Answer() { Text = incorrectAnswerText3, IsCorrect = false}; Card card = new Card() {Question = question, CorrectAnswer = correctAnswer, IncorrectAnswer1 = incorrectAnswer1, IncorrectAnswer2 = incorrectAnswer2, IncorrectAnswer3 = incorrectAnswer3}; Cards.Add(card); WriteToJSON(); }
private void getNextCardToDisplay() { ClearRadioButtons(); Random rnd = new Random(); randomCard = (Card)CardRepo.GetCard(); //ArrayList cards = new ArrayList(); randomCard = (Card)CardRepo.GetCard(); txtQuestion.Text = randomCard.Question; _randomNumber = rnd.Next(3); populateAnswerFieldsInRandomOrder(); }