Example #1
0
        public async Task LoadAsync(bool refresh = false)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            if (IsMultiSeason)
            {
                FeaturedVideo = await _animeService.GetLatestEpisodeAsync();

                var seasons = await _seasonService.ListAsync(new DataServices.ListRequest {
                    Skip = refresh ? 0 : Seasons.Count
                });

                Seasons.Clear();
                Seasons.AddRange(seasons);

                foreach (var season in Seasons)
                {
                    var episodes = await _animeService.ListEpisodeBySeasonAsync(new ListEpisodeBySeasonRequest { SeasonId = season.Id, Take = 5 });

                    season.Episodes.AddRange(episodes);
                }
            }
            else
            {
                List <Anime> animes = null;
                if (DataSource.ToLower() == "tvspecials")
                {
                    FeaturedVideo = await _animeService.GetLatestTvSpecialAsync();

                    animes = await _animeService.ListTvSpecialsAsync(new DataServices.ListRequest {
                        Skip = refresh ? 0 : Animes.Count
                    });
                }
                else if (DataSource.ToLower() == "movies")
                {
                    FeaturedVideo = await _animeService.GetLatestMovieAsync();

                    animes = await _animeService.ListMoviesAsync(new DataServices.ListRequest {
                        Skip = refresh ? 0 : Animes.Count
                    });
                }

                if (animes != null)
                {
                    Animes.Clear();
                    Animes.AddRange(animes);
                }
            }

            IsBusy = false;
        }
        public async Task LoadAsync()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            _appDataStorage.SaveAnime(Anime);

            List <Anime> animes = null;

            switch (AnimeType.ToLower())
            {
            case "stories":
                animes = await _animeService.ListStoriesAsync(new DataServices.ListRequest {
                    Skip = Animes.Count
                });

                break;

            case "tvspecials":
                animes = await _animeService.ListTvSpecialsAsync(new DataServices.ListRequest {
                    Skip = Animes.Count
                });

                break;

            case "movies":
                animes = await _animeService.ListMoviesAsync(new DataServices.ListRequest {
                    Skip = Animes.Count
                });

                break;
            }

            Animes.Clear();
            Animes.AddRange(animes);

            var seasons = await _seasonService.ListAsync(new DataServices.ListRequest {
                Skip = Seasons.Count
            });

            Seasons.Clear();
            Seasons.AddRange(seasons);

            IsBusy = false;
        }