/// <summary> /// Make a check box for each assumption. These checkboxes will automatically update the "Enabled" field of their corresponding assumption. /// </summary> private void MakeAssumptionCheckBoxes() { assumptionCheckboxes = new Dictionary <Assumption, CheckBox>(); foreach (Assumption assumption in Assumption.GetAssumptions().Values) { CheckBox cb = new CheckBox(); cb.IsChecked = assumption.Enabled; cb.Checked += new RoutedEventHandler(delegate(object sender, RoutedEventArgs e) { assumption.Enabled = true; }); cb.Unchecked += new RoutedEventHandler(delegate(object sender, RoutedEventArgs e) { assumption.Enabled = false; }); cb.Content = assumption.ToString(); assumptionCheckboxes.Add(assumption, cb); } }
/// <summary> /// Create the predefined groups. /// </summary> private static void CreatePredefGroups() { Groups = new List <ParseGroup>(); List <Assumption> assumptions = new List <Assumption>(Assumption.GetAssumptions().Values); //All assumptions ParseGroup pg = new ParseGroup("All"); pg.Predefined = true; pg.Assumptions.AddRange(assumptions); //Axioms pg = new ParseGroup("Axioms"); pg.Predefined = true; foreach (Assumption a in assumptions) { if (a.Type == Assumption.AssumptionType.Axiom) { pg.Assumptions.Add(a); } } //Definitions pg = new ParseGroup("Definitions"); pg.Predefined = true; foreach (Assumption a in assumptions) { if (a.Type == Assumption.AssumptionType.Definition) { pg.Assumptions.Add(a); } } //Theorems pg = new ParseGroup("Theorems"); pg.Predefined = true; foreach (Assumption a in assumptions) { if (a.Type == Assumption.AssumptionType.Theorem) { pg.Assumptions.Add(a); } } }
/// <summary> /// This method refreshes the selected and deselected assumption panes. /// </summary> /// <param name="selected">The current ParseGroup that is selected in the groups pane.</param> private void RefreshAssumptionLists(ParseGroup selected) { //Update selected pane SelectedAssumptions.ItemsSource = null; SelectedAssumptions.ItemsSource = selected.Assumptions; //Get unselected assumptions List <Assumption> unselectedAssumptions = new List <Assumption>(); foreach (Assumption a in Assumption.GetAssumptions().Values) { if (!selected.Assumptions.Contains(a)) { unselectedAssumptions.Add(a); } } //Update unselected pane UnselectedAssumptions.ItemsSource = null; UnselectedAssumptions.ItemsSource = unselectedAssumptions; }