void UpdateFavoritedSession(IMessagingService service, Session updatedSession) { var sessionInList = SessionsGrouped.SelectMany(g => g).FirstOrDefault(s => s.Id == updatedSession.Id); if (sessionInList != null && sessionInList.IsFavorite != updatedSession.IsFavorite) { sessionInList.IsFavorite = updatedSession.IsFavorite; } }
private async Task ExecuteLoadSessionsCommand() { if (IsBusy) { return; } IsBusy = true; Sessions.Clear(); try { var results = await Services.GetSessionsForConferenceId(Settings.Conference); foreach (var session in results.Where(s => s.IsApproved)) { Sessions.Add(session); } //Use linq to sorty our monkeys by name and then group them by the new name sort property var sorted = from session in Sessions orderby session.Name group session by session.TimeDisplay into sessionGroup select new Grouping <string, Session>(sessionGroup.Key, sessionGroup); SessionsGrouped.Clear(); //create a new collection of groups foreach (var sort in sorted) { SessionsGrouped.Add(sort); } } catch (Exception ex) { } finally { IsBusy = false; } }
void SortSessions() { SessionsGrouped.ReplaceRange(SessionsFiltered.FilterAndGroupByDate()); }