private void TheListDepsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action != NotifyCollectionChangedAction.Add) { return; } var isDepsChanged = false; foreach (var dep in e.NewItems.Cast <Department>()) { if (!Deps.Contains(dep.Title)) { Deps.Add(dep.Title); isDepsChanged = true; } } if (isDepsChanged) { ScatterbrainRepo.StoreDepartments(Deps).GetAwaiter().GetResult(); } if (_isSelfUpdatingDeps) { return; } ScatterbrainRepo.StoreSubjects(TheList).GetAwaiter().GetResult(); }
private void InitDeps() { var deps = ScatterbrainRepo.GetDepartments().GetAwaiter().GetResult(); if (deps != null) { Deps = deps; } else { Deps = new ObservableCollection <string>(); } }
private void InitTheList() { var theList = ScatterbrainRepo.GetSubjects().GetAwaiter().GetResult(); if (theList != null) { TheList = theList; } else { TheList = new TheList(); } TheList.Departments.CollectionChanged += TheListDepsChanged; }