// private Binding BindingForResponseDetailInDebuggerPane; private void DebugTabConceptComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // need to use event parameter rather than contents of combo box as // the combo box's text hasn't actually been set yet if (e.AddedItems.Count > 0) { DisplayBestRuleForConcept(e.AddedItems[0].ToString(), DebugTabFactsTextBox.Text); } else { ObservableCollectionOfRules collection = (ObservableCollectionOfRules)this.FindResource("RulesMatchingDebuggerCriterion"); collection.Clear(); } }
void DisplayBestRuleForConcept(string concept, string factstring) { ObservableCollectionOfRules collection = (ObservableCollectionOfRules)this.FindResource("RulesMatchingDebuggerCriterion"); collection.Clear(); System.Collections.Generic.SortedList <string, string> facts = new System.Collections.Generic.SortedList <string, string>(); facts.Add("concept", concept); AddColumnColonToDictionary(facts, factstring); foreach (KeyValuePair <Rule, float> pair in RRSys.FindAllRulesMatchingCriteria(facts)) { collection.Add(pair); } /* * Rule bestMatchingRule = RRSys.FindBestMatchingRule( facts ); * if ( bestMatchingRule != null ) * { * collection.Add(bestMatchingRule); * } */ }