/* * private void LoadNotifiedTherapists() * { * var therapistString = DataStorage.GetData(NOTIFIED); * if (string.IsNullOrEmpty(therapistString)) * return; * var ids = therapistString.Split('|').Select(long.Parse); * foreach (var id in ids) * { * var therapist = AllTherapists.First(t => t.ID == id); * //NotifiedTherapists.Add(therapist); * } * }*/ private void LoadStarredTherapists() { var therapistString = DataStorage.GetData(STARRED); if (string.IsNullOrEmpty(therapistString)) { return; } var ids = therapistString.Split('|').Select(long.Parse); foreach (var id in ids) { var therapist = AllTherapists.First(t => t.ID == id); StarredTherapists.Add(therapist); } }
/* * private void NotifiedTherapists_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) * { * var starredString = string.Join("|", NotifiedTherapists.Select(t => t.ID)); * DataStorage.SaveValue(NOTIFIED, starredString); * } * private void NotifyWhenTherapistsAreReachable() * { * var therapistString = DataStorage.GetData(NOTIFIED); * if (string.IsNullOrEmpty(therapistString)) * therapistString = ""; * var ids = therapistString.Length > 0 ? therapistString.Split('|').Select(long.Parse) : Enumerable.Empty<long>(); * var notifiedTherapists = ids.Select(id => AllTherapists.First(t => t.ID == id)).ToArray(); * foreach (var therapist in notifiedTherapists.Where(t => !NotifiedTherapists.Contains(t))) * { * UnNotify(therapist); * } * foreach (var therapist in NotifiedTherapists.Where(t => !notifiedTherapists.Contains(t))) * { * Notify(therapist); * } * } * * private void Notify(Therapist therapist) * { * * }*/ private void StarredTherapists_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { var starredString = string.Join("|", StarredTherapists.Select(t => t.ID)); App.Instance.AppState.DataStorage.SaveValue(STARRED, starredString); }