Esempio n. 1
0
        private void LoadTrendingShows(int page)
        {
            IsLoading = true;

            _tvshowtimeApiService.GetTrendingShows(page, _pageSize)
            .Subscribe(async(exploreResponse) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    foreach (var show in exploreResponse.Shows)
                    {
                        // Do not add the same show twice
                        if (Shows.Any(s => s.Id == show.Id))
                        {
                            continue;
                        }

                        var exploreShowViewModel = new ExploreShowViewModel
                        {
                            Id        = show.Id,
                            Name      = show.Name,
                            Overview  = show.Overview,
                            AllImages = show.AllImages,
                            Followed  = show.Followed,
                            Original  = show
                        };
                        Shows.Add(exploreShowViewModel);
                    }

                    IsLoading = false;
                });
            },
                       async(error) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    IsLoading = false;
                });

                _toastNotificationService.ShowErrorNotification("An error happened. Please retry later.");
            });
        }
Esempio n. 2
0
 private void ToggleFollowShow(ExploreShowViewModel show)
 {
     if (show.Followed.HasValue && show.Followed.Value)
     {
         // Unfollow
         _tvshowtimeApiService.UnfollowShow(show.Id)
         .Subscribe(async(response) =>
         {
             await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
             {
                 show.Followed          = false;
                 show.Original.Followed = false;
                 _eventService.UnfollowShow(show.Original);
             });
         },
                    (error) =>
         {
             throw new Exception();
         });
     }
     else
     {
         // Follow
         _tvshowtimeApiService.FollowShow(show.Id)
         .Subscribe(async(response) =>
         {
             await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
             {
                 show.Followed          = true;
                 show.Original.Followed = true;
                 _eventService.FollowShow(show.Original);
             });
         },
                    (error) =>
         {
             throw new Exception();
         });
     }
 }
Esempio n. 3
0
        private void LoadTrendingShows(int page)
        {
            _isLoadingShows = true;

            _tvshowtimeApiService.GetTrendingShows(page, _pageSize)
            .Subscribe(async(exploreResponse) =>
            {
                await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                {
                    foreach (var show in exploreResponse.Shows)
                    {
                        // Do not add the same show twice
                        if (Shows.Any(s => s.Id == show.Id))
                        {
                            continue;
                        }

                        var exploreShowViewModel = new ExploreShowViewModel
                        {
                            Id        = show.Id,
                            Name      = show.Name,
                            Overview  = show.Overview,
                            AllImages = show.AllImages,
                            Followed  = show.Followed,
                            Original  = show
                        };
                        Shows.Add(exploreShowViewModel);
                    }

                    _isLoadingShows = false;
                });
            },
                       (error) =>
            {
                throw new Exception();
            });
        }