Exemple #1
0
 public MainViewModel()
 {
     InputViewModel           = new InputViewModel();
     CriterionPickerViewModel = new CriterionPickerViewModel(InputViewModel);
     InputViewModel.InitializeCallbacks(CriterionPickerViewModel.AddStateParameters, CriterionPickerViewModel.RemoveStateParameters);
     RunCommand      = new CommandHandler <Action>(Run, () => true);
     OpenFileCommand = new CommandHandler <Func <string> >(OpenFile, () => true);
 }
Exemple #2
0
        private void ParseCsv(IEnumerable <IEnumerable <string> > values)
        {
            var lists      = values.Select(v => v.ToList()).ToList();
            var caseLabels = lists.Skip(1).Select(l => l.First()).ToList();
            var states     = lists.First().ToDictionary(l => l, l => new List <double>());

            for (var i = 0; i < states.Count; i++)
            {
                states.ElementAt(i).Value.AddRange(lists.Skip(1).Select(l => double.Parse(l[i + 1])));
            }

            InputViewModel.CaseLabels = new ObservableCollection <ObservableValue <string> >(caseLabels.Select(c => new ObservableValue <string>(c)));
            InputViewModel.States     = new ObservableCollection <KeyValuePair <ObservableValue <string>, ObservableCollection <ObservableValue <double> > > >(
                states.Select(s =>
                              new KeyValuePair <ObservableValue <string>, ObservableCollection <ObservableValue <double> > >(
                                  s.Key, new ObservableCollection <ObservableValue <double> >(
                                      s.Value.Select(v => new ObservableValue <double>(v)))))
                );
            CriterionPickerViewModel.SetParameters();
        }