private void ScorerTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var dg = Locator.FindParent <DataGrid>(sender as DependencyObject); if (e.AddedItems.Count == 1 && (e.RemovedItems.Count == 0 || (e.RemovedItems.Count == 1 && e.AddedItems[0] != e.RemovedItems[0]))) { ScorerType scorerType = (ScorerType)(new ScorerEditorStringConverterExtension().ConvertBack(e.AddedItems[0], new ScorerType().GetType(), null, null)); EditableCriterion ec = dg.SelectedItem as EditableCriterion; ec.ScorerType = scorerType; } }
public static Scorer Create(ScorerType scorerType) { switch (scorerType) { case ScorerType.Basic: return(new BasicScorer()); case ScorerType.Simple: return(new SimpleScorer()); default: throw new NotImplementedException("Scorer.Create"); } }
/// <summary> /// 스코어를 선택한다. /// </summary> /// <param name="scorerType"></param> public void SelectScorer(ScorerType scorerType) { _scorer = Scorer.Create(scorerType); }