Permalink
Browse files

Allow editing analyses

  • Loading branch information...
1 parent 83e90b4 commit f054162221266525898b7d1ac72a65509f1618ad @grollinger grollinger committed Mar 31, 2012
Showing with 21 additions and 0 deletions.
  1. +21 −0 DiversityPhone/ViewModels/Edit/EditAnalysisVM.cs
View
21 DiversityPhone/ViewModels/Edit/EditAnalysisVM.cs
@@ -73,10 +73,31 @@ public EditAnalysisVM(IVocabularyService voc)
_Parent
.Select(parent => Vocabulary.getPossibleAnalyses(parent.Model.TaxonomicGroup))
.Subscribe(Analyses);
+
+ Analyses.ItemsObservable
+ .Zip(ValidModel, (analyses, iuan) =>
+ analyses
+ .Where(an => an.AnalysisID == iuan.AnalysisID)
+ .FirstOrDefault())
+ .Where(x => x != null)
+ .BindTo(Analyses, x => x.SelectedItem);
Analyses
.Select(selectedAN => (selectedAN != null) ? Vocabulary.getPossibleAnalysisResults(selectedAN.AnalysisID) : null)
.Subscribe(Results);
+
+ Results.ItemsObservable
+ .Zip(ValidModel, (results, iuan) =>
+ results
+ .Where(res => res.Result == iuan.AnalysisResult)
+ .FirstOrDefault())
+ .Where(x => x != null)
+ .BindTo(Results, x => x.SelectedItem);
+
+ ValidModel
+ .Select(iuan => iuan.AnalysisResult)
+ .BindTo(this, x => x.CustomResult);
+
_IsCustomResult = Results.ItemsObservable
.Where(res => res != null)
.Select(results => results.Count == 0)

0 comments on commit f054162

Please sign in to comment.