void AddTopicChoice(object sender, RoutedEventArgs e) { if (selectedTopic != null) { FinalRounderChoice choice = new FinalRounderChoice(false, "New choice"); selectedTopic.Items.Add(choice); selectedTopic.IsExpanded = true; choice.IsSelected = true; choiceAnswer.SelectAll(); choiceAnswer.Focus(); finalRoundList.Unsaved = true; } }
void FinalRoundSelection(object sender, RoutedPropertyChangedEventArgs <object> e) { TreeViewItem selected = (TreeViewItem)((TreeView)sender).SelectedItem; if (selected is FinalRounder topic) { DeselectChoice(); SelectFinalQuestion(topic); } else if (selected != null) { selectedChoice = (FinalRounderChoice)selected; choiceCorrect.IsChecked = selectedChoice.Correct; choiceAnswer.Text = selectedChoice.Text; SelectFinalQuestion((FinalRounder)selected.Parent); } }
void AddTopicChoices(object sender, RoutedEventArgs e) { if (selectedTopic != null) { BulkOption form = new BulkOption(); bool? result = form.ShowDialog(); if (result.HasValue && result.Value) { selectedTopic.IsExpanded = true; finalRoundList.Unsaved = true; string[] correct = form.CorrectValues, incorrect = form.IncorrectValues; for (int i = 0; i < correct.Length; ++i) { FinalRounderChoice choice = new FinalRounderChoice(true, correct[i]); selectedTopic.Items.Add(choice); } for (int i = 0; i < incorrect.Length; ++i) { FinalRounderChoice choice = new FinalRounderChoice(false, incorrect[i]); selectedTopic.Items.Add(choice); } } } }
void DeselectChoice() { selectedChoice = null; choiceCorrect.IsChecked = false; choiceAnswer.Text = string.Empty; }