Exemple #1
0
    private async Task <List <ShowViewModel> > ConvertToViewModels(IEnumerable <Show> podcasts)
    {
        var viewmodels = new List <ShowViewModel>();

        foreach (var podcast in podcasts)
        {
            var podcastViewModel = new ShowViewModel(podcast, subscriptionsService);
            await podcastViewModel.InitializeAsync();

            viewmodels.Add(podcastViewModel);
        }

        return(viewmodels);
    }
    public async Task InitializeAsync()
    {
        var podcasts = subscriptionsService.GetSubscribedShows();

        SubscribedShows.Clear();
        foreach (var podcast in podcasts)
        {
            var podcastViewModel = new ShowViewModel(podcast, subscriptionsService);
            await podcastViewModel.InitializeAsync();

            SubscribedShows.Add(podcastViewModel);
        }
        OnPropertyChanged(nameof(HasData));
        OnPropertyChanged(nameof(HasNoData));
    }
Exemple #3
0
    private async Task <List <ShowViewModel> > LoadShows(IEnumerable <Show> shows)
    {
        var showList = new List <ShowViewModel>();

        if (shows == null)
        {
            return(showList);
        }

        foreach (var show in shows)
        {
            var showVM = new ShowViewModel(show, subscriptionsService);
            await showVM.InitializeAsync();

            showList.Add(showVM);
        }

        return(showList);
    }