private void SubscribeAddOptionM() { MessagingCenter.Subscribe <NewOptionViewModel, Option>(this, "AddOptionM", (sender, args) => { foreach (var _criteria in CurrentEvaluation.Criterias) { if (_criteria.Options != null) { _criteria.Options.Add(args); } else { _criteria.Options = new ObservableRangeCollection <Option>().ToList(); _criteria.Options.Add(args); } } CurrentEvaluation.Criterias = new List <Criteria>(Criterias.ToList()); SqLiteConnection.UpdateWithChildren(CurrentEvaluation); Options = new ObservableCollection <Option>(CurrentEvaluation.Options); }); }
private void SubscribeAddCriteriaM() { MessagingCenter.Subscribe <NewCriteriaViewModel, Criteria>(this, "AddCriteriaM", (sender, args) => { //Add Options to new Criteria args.Options = CurrentEvaluation.Options; //Add new Criteria to Collection if (Criterias != null) { Criterias.Add(args); } else { Criterias = new ObservableRangeCollection <Criteria>(); Criterias.Add(args); } CurrentEvaluation.Criterias = new List <Criteria>(Criterias.ToList()); //Update full Evaluation SqLiteConnection.UpdateWithChildren(CurrentEvaluation); }); }