private void RefreshByEpisodeId(long episodeId) { var request = new EpisodeRequestByEpisodeId { EpisodeId = episodeId }; _tvshowtimeApiService.GetEpisode(request) .Subscribe(async(episodeResponse) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { Episode = episodeResponse.Episode; RaisePropertyChanged(nameof(Episode)); }); }, (error) => { throw new Exception(); }); }
private void ToggleWatch() { bool markAsWatch = !(Episode.Seen.HasValue && Episode.Seen.Value); var request = new EpisodeRequestByEpisodeId { EpisodeId = Episode.Id }; IObservable <Response> toggleWatchObservable; if (markAsWatch) { toggleWatchObservable = _tvshowtimeApiService.MarkEpisodeWatched(request, false, false); } else { toggleWatchObservable = _tvshowtimeApiService.UnmarkEpisodeWatched(request); } toggleWatchObservable.Subscribe(async(response) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { Episode.Seen = !Episode.Seen; RaisePropertyChanged(nameof(Episode)); if (markAsWatch) { _eventService.WatchEpisode(Episode); } else { _eventService.UnwatchEpisode(Episode); } }); }, (error) => { throw new Exception(); }); }