示例#1
0
        private async Task NavigateToYearsInternal()
        {
            var item = await GetRootFolder();

            var displayPreferences = await PresentationManager.GetDisplayPreferences("MovieYears", CancellationToken.None);

            var yearIndex = await ApiClient.GetYearIndex(_sessionManager.CurrentUser.Id, new[] { "Movie" }, CancellationToken.None);

            var indexOptions = yearIndex.Where(i => !string.IsNullOrEmpty(i.Name)).OrderByDescending(i => i.Name).Select(i => new TabItem
            {
                Name        = i.Name,
                DisplayName = i.Name
            });

            var options = new ListPageConfig
            {
                IndexOptions    = indexOptions.ToList(),
                PageTitle       = "Movies",
                CustomItemQuery = GetMoviesByYear
            };

            SetDefaults(options);

            options.DefaultViewType = ListViewTypes.PosterStrip;

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Movies
            };

            await _navService.Navigate(page);
        }
示例#2
0
        private async Task NavigateToTrailersInternal()
        {
            var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

            var displayPreferences = await PresentationManager.GetDisplayPreferences("Trailers", CancellationToken.None);

            var options = new ListPageConfig
            {
                SortOptions     = GetMovieSortOptions(),
                PageTitle       = "Trailers",
                CustomItemQuery = GetTrailers
            };

            SetDefaults(options);

            options.DefaultViewType = ListViewTypes.PosterStrip;

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager,
                                      PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Movies
            };

            await _navService.Navigate(page);
        }
示例#3
0
        private async Task NavigateToMultiPlayerGamesInternal()
        {
            var item = await GetRootFolder();

            var displayPreferences = await PresentationManager.GetDisplayPreferences("MultiPlayerGames", CancellationToken.None);

            var playerIndex = await ApiClient.GetGamePlayerIndex(_sessionManager.CurrentUser.Id, CancellationToken.None);

            var indexOptions = playerIndex.Where(i => !string.IsNullOrEmpty(i.Name) && int.Parse(i.Name) > 1).Select(i => new TabItem
            {
                Name        = i.Name,
                DisplayName = i.Name + " Player (" + i.ItemCount + ")"
            });

            var options = new ListPageConfig
            {
                IndexOptions    = indexOptions.ToList(),
                PageTitle       = "Games",
                CustomItemQuery = GetMultiPlayerGames
            };

            SetDefaults(options, null);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Games
            };

            await _navService.Navigate(page);
        }
示例#4
0
        public async Task NavigateToAllShows()
        {
            var item = await GetRootFolder();

            var displayPreferences = await PresentationManager.GetDisplayPreferences("Shows", CancellationToken.None);

            var options = new ListPageConfig
            {
                PageTitle       = "TV",
                CustomItemQuery = GetAllShows,
                SortOptions     = GetSeriesSortOptions()
            };

            SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, options)
            {
                ViewType = ViewType.Tv
            };

            await _navService.Navigate(page);
        }
示例#5
0
        private async Task NavigateToGenreInternal(string itemType, string includeItemType, string pageTitle, Func <ItemListViewModel, DisplayPreferences, Task <ItemsResult> > query, string selectedGenre)
        {
            var apiClient = _sessionFactory().ActiveApiClient;

            var root = await apiClient.GetRootFolderAsync(apiClient.CurrentUserId);

            var displayPreferences = await _presentationManager.GetDisplayPreferences(itemType + "Genres", CancellationToken.None);

            var genres = await apiClient.GetGenresAsync(new ItemsByNameQuery
            {
                IncludeItemTypes = new[] { includeItemType },
                SortBy           = new[] { ItemSortBy.SortName },
                Recursive        = true,
                UserId           = _sessionFactory().LocalUserId
            });

            var indexOptions = genres.Items.Select(i => new TabItem
            {
                Name        = i.Name,
                DisplayName = i.Name
            });

            var options = new ListPageConfig
            {
                IndexOptions    = indexOptions.ToList(),
                IndexValue      = selectedGenre,
                PageTitle       = pageTitle,
                CustomItemQuery = query
            };

            options.DefaultViewType = ListViewTypes.PosterStrip;

            var page = new FolderPage(root, displayPreferences, apiClient, _imageManager, _presentationManager, this, _playbackManagerFactory(), _logger, options)
            {
                ViewType = ViewType.Movies
            };

            await Navigate(page);
        }
        private async void NavigateToFavorites(string type)
        {
            try
            {
                var itemCounts = await ApiClient.GetItemCountsAsync(new ItemCountsQuery
                {
                    UserId     = _sessionManager.CurrentUser.Id,
                    IsFavorite = true
                });

                var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

                var displayPreferences = await PresentationManager.GetDisplayPreferences("Favorites", CancellationToken.None);

                displayPreferences.PrimaryImageWidth = GetImageWidth(type);

                var options = new ListPageConfig
                {
                    IndexOptions    = GetFavoriteTabs(itemCounts).ToList(),
                    PageTitle       = "Favorites",
                    CustomItemQuery = GetFavoriteItems
                };

                var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager,
                                          PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
                {
                    ViewType = ViewType.Folders
                };

                await _navService.Navigate(page);
            }
            catch (Exception ex)
            {
                _logger.Error("Error navigating to favorites", ex);

                PresentationManager.ShowDefaultErrorMessage();
            }
        }
        private async Task NavigateToRomanticTvInternal()
        {
            var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

            var displayPreferences = await PresentationManager.GetDisplayPreferences("RomanticShows", CancellationToken.None);

            var options = new ListPageConfig
            {
                PageTitle       = "Date Night",
                CustomItemQuery = GetRomanticSeries,
                SortOptions     = GetSeriesSortOptions()
            };

            SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager,
                                      PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Tv
            };

            await _navService.Navigate(page);
        }
        private async Task NavigateToActorsInternal()
        {
            var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

            var displayPreferences = await PresentationManager.GetDisplayPreferences("People", CancellationToken.None);

            var options = new ListPageConfig
            {
                IndexOptions    = AlphabetIndex,
                PageTitle       = "TV | Actors",
                CustomItemQuery = GetAllActors
            };

            SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager,
                                      PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Tv
            };

            await _navService.Navigate(page);
        }
        private async Task NavigateToAllMoviesInternal()
        {
            var item = await _apiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

            var displayPreferences = await _presentationManager.GetDisplayPreferences("Movies", CancellationToken.None);

            var options = new ListPageConfig
            {
                PageTitle       = "Movies",
                CustomItemQuery = GetAllMovies,
                SortOptions     = MoviesViewModel.GetMovieSortOptions()
            };

            MoviesViewModel.SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, _apiClient, _imageManager, _sessionManager,
                                      _presentationManager, _nav, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Movies
            };

            await _nav.Navigate(page);
        }
        private async Task NavigateToGenresInternal()
        {
            var item = await ApiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

            var displayPreferences = await PresentationManager.GetDisplayPreferences("TVGenres", CancellationToken.None);

            var genres = await ApiClient.GetGenresAsync(new ItemsByNameQuery
            {
                IncludeItemTypes = new[] { "Series" },
                SortBy           = new[] { ItemSortBy.SortName },
                Recursive        = true,
                UserId           = _sessionManager.CurrentUser.Id
            });

            var indexOptions = genres.Items.Select(i => new TabItem
            {
                Name        = i.Name,
                DisplayName = i.Name + " (" + i.SeriesCount + ")"
            });

            var options = new ListPageConfig
            {
                IndexOptions    = indexOptions.ToList(),
                PageTitle       = "TV | Genres",
                CustomItemQuery = GetSeriesByGenre
            };

            SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, _sessionManager,
                                      PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Tv
            };

            await _navService.Navigate(page);
        }
示例#11
0
        private async Task NavigateToMoviesInternal(string indexValue)
        {
            var item = await GetRootFolder();

            var displayPreferences = await PresentationManager.GetDisplayPreferences("Movies", CancellationToken.None);

            var view = _moviesView ?? await ApiClient.GetMovieView(_sessionManager.CurrentUser.Id, ParentId, CancellationToken.None);

            var tabs = new List <TabItem>();

            tabs.Add(new TabItem
            {
                DisplayName = "All Movies",
                Name        = "AllMovies"
            });

            tabs.Add(new TabItem
            {
                DisplayName = "Unwatched",
                Name        = "Unwatched",
            });

            tabs.Add(new TabItem
            {
                DisplayName = "New Releases",
                Name        = "NewReleases",
            });

            tabs.Add(new TabItem
            {
                DisplayName = "Trailers",
                Name        = "Trailers",
            });

            tabs.Add(new TabItem
            {
                DisplayName = "Favorites",
                Name        = "FavoriteMovies"
            });

            if (view.BoxSetItems.Count > 0)
            {
                tabs.Add(new TabItem
                {
                    DisplayName = "Box Sets",
                    Name        = "BoxSets",
                });
            }

            if (view.FamilyMovies.Count > 0)
            {
                tabs.Add(new TabItem
                {
                    DisplayName = "Family",
                    Name        = "Family",
                });
            }

            tabs.Add(new TabItem
            {
                DisplayName = "Popular",
                Name        = "TopRated",
            });

            tabs.Add(new TabItem
            {
                DisplayName = "Critically Acclaimed",
                Name        = "TopCriticRated",
            });

            if (view.ThreeDItems.Count > 0)
            {
                tabs.Add(new TabItem
                {
                    DisplayName = "3D Movies",
                    Name        = "3DMovies",
                });
            }

            var options = new ListPageConfig
            {
                PageTitle       = " ",
                CustomItemQuery = GetMovies,
                IndexOptions    = tabs,
                IndexValue      = indexValue,
                SortOptions     = GetMovieSortOptions()
            };

            SetDefaults(options);

            var page = new FolderPage(item, displayPreferences, ApiClient, _imageManager, PresentationManager, _navService, _playbackManager, _logger, _serverEvents, options)
            {
                ViewType = ViewType.Movies
            };

            await _navService.Navigate(page);
        }
        public void AddNewFolderPageToFolder(int pageNum, IFolder folder)
        {
            IFolderPage page = new FolderPage(folder.Name, folder.Path, new IFolderContent[0]);

            _folderContentPageRepository.CreateOrUpdateFolderPage(folder.Name, folder.Path, pageNum, page);
        }