private void LoadAgendaPage(int page) { IsLoading = true; _tvshowtimeApiService.GetAgenda(page, 10, true) .Subscribe(async(agendaResponse) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { foreach (var episode in agendaResponse.Episodes) { // Do not add an episode without air date if (!episode.AirDate.HasValue) { continue; } // Do not add the same episode twice if (IsAlreadyAdded(episode)) { continue; } // Add episode to the corresponding group var group = Groups.FirstOrDefault(g => g.Date == episode.AirDate); // Create a new group if necessary if (group == null) { group = new AgendaGroup { Date = episode.AirDate.Value }; int index = Groups.Count(g => g.Date < episode.AirDate.Value); Groups.Insert(index, group); } group.Episodes.Add(episode); } IsLoading = false; }); }, async(error) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { IsLoading = false; }); _toastNotificationService.ShowErrorNotification("An error happened. Please retry later."); }); }
private void LoadAgendaPage(int page) { _isLoadingAgenda = true; _tvshowtimeApiService.GetAgenda(page, 10, true) .Subscribe(async(agendaResponse) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { foreach (var episode in agendaResponse.Episodes) { // Do not add an episode without air date if (!episode.AirDate.HasValue) { return; } // Do not add the same episode twice if (IsAlreadyAdded(episode)) { return; } // Add episode to the corresponding group var group = Groups.FirstOrDefault(g => g.Date == episode.AirDate); // Create a new group if necessary if (group == null) { group = new AgendaGroup { Date = episode.AirDate.Value }; int index = Groups.Count(g => g.Date < episode.AirDate.Value); Groups.Insert(index, group); } group.Episodes.Add(episode); } _isLoadingAgenda = false; }); }, (error) => { throw new Exception(); }); }
public void setFocus(AgendaGroup focus) { this._javaWorkingMemory.setFocus(focus); }