public void UpdateQuestions() { QuestionsStackPanel.Children.Clear(); foreach (var wrongQuestionID in QuestionManager.WrongAnsweredQuestions) { QuestionsStackPanel.Children.Add(new CheckQuestionItem(QuestionManager.GetWrongQuestion(wrongQuestionID.ID), QuestionManager.GetQuestion(wrongQuestionID.ID))); } }
public void AddNewQuestion() { if (actualQuestionNumber > QuestionManager.Questions.Count) { return; } actualAnswers.Clear(); AnswersStackPanel.Children.Clear(); GoodAnswerCountsLabel.Content = string.Empty; QuestionNumberLabel.Content = string.Empty; QuestionTextBlock.Text = string.Empty; var question = QuestionManager.GetQuestion(actualQuestionNumber); if (question == null) { return; } QuestionNumberLabel.Content = $"{question.ID + 1}. kérdés"; QuestionTextBlock.Text = question.Name; QuestionNumberInputTextBox.Text = (actualQuestionNumber + 1).ToString(); var rand = new Random(); var shuffledAnswers = new List <Answer>(question.Answers); shuffledAnswers = shuffledAnswers.OrderBy(x => rand.Next()).ToList(); foreach (var answer in shuffledAnswers) { AnswersStackPanel.Children.Add(new AnswerContent(answer)); AddAnswer(answer.ID, answer.Name, answer.Right); } actualQuestions.Add(question); CheckAnswersButton.IsEnabled = true; NextQuestionButton.IsEnabled = false; PrevQuestionButton.IsEnabled = false; }
private void InsertDraggedQuestionItem() { if (beforeDrag == afterDrag) { return; } var temp = QuestionManager.GetQuestion(beforeDrag); for (int i = afterDrag; i < QuestionManager.Questions.Count; i++) { QuestionManager.Questions[i].SetID(i + 1); } temp.SetID(afterDrag); questionItems = (from questionItem in questionItems orderby questionItem.ID ascending select questionItem).ToList(); InitQuestionItems(); SaveQuestions(); }