コード例 #1
0
        private async Task PopulatePage(string navigationArgs)
        {
            string showName = navigationArgs.Split("_".ToArray())[1];

            ShowNameTextBlock.Text = showName;

            var shows = await VideoLibrary.GetTVShows();

            int showId = shows.Where(show => show.Title == showName).FirstOrDefault().TvShowId;

            if (showId == null)
            {
                return;
            }

            Filter newFilter = new Filter {
                Field = "playcount", Operator = "is", value = "0"
            };

            Sort sort = new Sort {
                Method = "label", IgnoreArticle = true, Order = "ascending"
            };

            var newEpisodes = new EpisodesCollection(newFilter, sort, showId);

            NewEpisodesListView.ItemsSource = newEpisodes;

            Filter watchedFilter = new Filter {
                Field = "playcount", Operator = "greaterthan", value = "0"
            };

            var watchedEpisodes = new EpisodesCollection(watchedFilter, sort, showId);

            WatchedEpisodesListView.ItemsSource = watchedEpisodes;

            if (await VideoLibrary.GetEpisodesCount(tvShowID: showId) == 0)
            {
                string        message       = String.Format("No episodes were found in {0}. We will take you to the library now.", showName);
                string        messageHeader = "Nothing Here!";
                MessageDialog msg           = new MessageDialog(message, messageHeader);
                await msg.ShowAsync();

                Frame.Navigate(typeof(CoverPage));
            }
        }
コード例 #2
0
        private async Task PopulatePage(string navigationArgs)
        {
            string showName = navigationArgs.Split("_".ToArray())[1];
            ShowNameTextBlock.Text = showName;

            var shows = await VideoLibrary.GetTVShows();
            int showId = shows.Where(show => show.Title == showName).FirstOrDefault().TvShowId;

            if (showId == null)
                return;

            Filter newFilter = new Filter { Field = "playcount", Operator = "is", value = "0" };

            Sort sort = new Sort { Method = "label", IgnoreArticle = true, Order = "ascending" };

            var newEpisodes = new EpisodesCollection(newFilter, sort, showId);
            NewEpisodesListView.ItemsSource = newEpisodes;

            Filter watchedFilter = new Filter { Field = "playcount", Operator = "greaterthan", value = "0" };

            var watchedEpisodes = new EpisodesCollection(watchedFilter, sort, showId);
            WatchedEpisodesListView.ItemsSource = watchedEpisodes;
            
            if (await VideoLibrary.GetEpisodesCount(tvShowID: showId) == 0)
            {
                string message = String.Format("No episodes were found in {0}. We will take you to the library now.", showName);
                string messageHeader = "Nothing Here!";
                MessageDialog msg = new MessageDialog(message, messageHeader);
                await msg.ShowAsync();
                Frame.Navigate(typeof(CoverPage));
            }
        }