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); }
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); }
public static void SetDefaults(ListPageConfig config) { config.DefaultViewType = ListViewTypes.Poster; config.PosterImageWidth = PosterWidth; config.ThumbImageWidth = ThumbstripWidth; config.ListImageWidth = ListImageWidth; }
private void ParseItems <TSchema>(ListPageConfig <TSchema> listConfig, CachedContent <TSchema> content, Func <ItemViewModel, bool> filterFunc) where TSchema : SchemaBase { var parsedItems = new List <ItemViewModel>(); foreach (var item in GetVisibleItems(content, _visibleItems)) { var parsedItem = new ItemViewModel { Id = item._id, NavigationInfo = listConfig.DetailNavigation(item) }; listConfig.LayoutBindings(parsedItem, item); if (filterFunc == null) { parsedItems.Add(parsedItem); } else if (filterFunc(parsedItem)) { parsedItems.Add(parsedItem); } } Items.Sync(parsedItems); HasItems = Items.Count > 0; HasMoreItems = content.Items.Count() > Items.Count; }
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); }
public UserProfileWindow(DefaultThemePageMasterCommandsViewModel masterCommands, ISessionManager session, IPresentationManager presentationManager, IImageManager imageManager, IApiClient apiClient, ITheaterConfigurationManager configurationManager, DisplayPreferences displayPreferences, ListPageConfig options) { _session = session; _options = options; _displayPreferencesViewModel = new DisplayPreferencesViewModel(displayPreferences, presentationManager, configurationManager, session); _previousFocus = ""; InitializeComponent(); Loaded += UserProfileWindow_Loaded; Unloaded += UserProfileWindow_Unloaded; masterCommands.PageNavigated += masterCommands_PageNavigated; BtnClose.Click += BtnClose_Click; //Display preferences RadioList.Click += radioList_Click; RadioPoster.Click += radioPoster_Click; RadioThumbstrip.Click += radioThumbstrip_Click; RadioPosterStrip.Click += radioPosterStrip_Click; //Sort preferences RadioSortAscending.Click += RadioSortAscending_Click; RadioSortDescending.Click += RadioSortDescending_Click; //Focus tracking BtnClose.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; HomeButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; DisplayPreferencesButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SortButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SettingsButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; LogoutButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ShutdownAppButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SleepButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RestartButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ShutdownButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioList.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioPosterStrip.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioPoster.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioThumbstrip.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioSortAscending.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioSortDescending.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; CheckBoxSortRemember.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ContentGrid.DataContext = new DefaultThemeUserDtoViewModel(masterCommands, apiClient, imageManager, session) { User = session.CurrentUser, ImageHeight = 54 }; MainGrid.DataContext = this; CheckBoxSortRemember.DataContext = _displayPreferencesViewModel; }
private void ParseItems <TSchema>(ListPageConfig <TSchema> listConfig, CachedContent <TSchema> content) where TSchema : SchemaBase { foreach (var item in content.Items) { var parsedItem = new ItemViewModel { Id = item._id, NavigationInfo = listConfig.DetailNavigation(item) }; listConfig.LayoutBindings(parsedItem, item); _items.Add(parsedItem); } HasItems = _items.Count > 0; }
private ListPageConfig GetChannelPageConfig(BaseItemDto item, ViewType context) { var config = new ListPageConfig(); config.CustomItemQuery = (vm, displayPreferences) => { return(GetChannelItems(new ChannelItemQuery { UserId = _sessionManager.CurrentUser.Id, ChannelId = item.IsType("channel") ? item.Id : item.ChannelId, FolderId = item.IsType("channel") ? null : item.Id, Fields = FolderPage.QueryFields }, CancellationToken.None)); }; return(config); }
private void ParseRelatedItems <TSchema>(ListPageConfig <TSchema> listConfig, CachedContent <TSchema> content) where TSchema : SchemaBase { var parsedItems = new List <ItemViewModel>(); foreach (var item in content.Items) { var parsedItem = new ItemViewModel { Id = item._id, NavigationInfo = listConfig.DetailNavigation(item) }; listConfig.LayoutBindings(parsedItem, item); parsedItems.Add(parsedItem); } RelatedItems.Sync(parsedItems); }
protected virtual void ShowUserMenu() { var page = NavigationService.CurrentPage as IHasDisplayPreferences; DisplayPreferences displayPreferences = null; ListPageConfig options = null; if (page != null) { displayPreferences = page.GetDisplayPreferences(); options = page.GetListPageConfig(); } var userProfileWindow = new UserProfileWindow(this, SessionManager, PresentationManager, ImageManager, ApiClient, ConfigurationManager, displayPreferences, options); userProfileWindow.Closed += userProfileWindow_Closed; userProfileWindow.ShowModal(PresentationManager.Window); }
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); }
public static void SetDefaults(ListPageConfig config, string gameSystem) { config.DefaultViewType = ListViewTypes.PosterStrip; config.PosterImageWidth = PosterWidth; config.ThumbImageWidth = ThumbstripWidth; config.ListImageWidth = 160; config.PosterStripImageWidth = PosterStripWidth; if (string.Equals(gameSystem, GameSystem.Nintendo64, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 400; config.PosterStripImageWidth = 480; } else if (string.Equals(gameSystem, GameSystem.SuperNintendo, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 400; config.PosterStripImageWidth = 480; } else if (string.Equals(gameSystem, GameSystem.SegaSaturn, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 200; config.PosterStripImageWidth = 250; } else if (string.Equals(gameSystem, GameSystem.SegaCD, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 200; config.PosterStripImageWidth = 250; } else if (string.Equals(gameSystem, GameSystem.SonyPlaystation, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 300; config.PosterStripImageWidth = 380; } else if (string.Equals(gameSystem, GameSystem.SegaDreamcast, StringComparison.OrdinalIgnoreCase)) { config.PosterImageWidth = 300; config.PosterStripImageWidth = 380; } }
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); }
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 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 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 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); }
private ListPageConfig GetListPageConfig(BaseItemDto item, ViewType context) { var config = new ListPageConfig(); if (context == ViewType.Tv) { TvViewModel.SetDefaults(config); if (item.IsType("season")) { config.DefaultViewType = ListViewTypes.List; } } else if (context == ViewType.Movies) { MoviesViewModel.SetDefaults(config); } else if (context == ViewType.Games) { GamesViewModel.SetDefaults(config, item.GameSystem); } return(config); }
private ListPageConfig GetListPageConfig(BaseItemDto item, ViewType context) { var config = new ListPageConfig(); if (context == ViewType.Tv || item.IsType("season")) { TvViewModel.SetDefaults(config); if (item.IsType("season")) { config.DefaultViewType = ListViewTypes.List; config.PosterImageWidth = 480; config.PosterStripImageWidth = 592; config.ThumbImageWidth = 592; } } else if (context == ViewType.Movies) { MoviesViewModel.SetDefaults(config); } else if (context == ViewType.Games) { GamesViewModel.SetDefaults(config, item.GameSystem); } if (item.IsFolder) { config.CustomItemQuery = (vm, displayPreferences) => { if (item.IsType("series")) { return(_apiClient.GetSeasonsAsync(new SeasonQuery { UserId = _sessionManager.CurrentUser.Id, SeriesId = item.Id, Fields = FolderPage.QueryFields }, CancellationToken.None)); } if (item.IsType("season")) { return(_apiClient.GetEpisodesAsync(new EpisodeQuery { UserId = _sessionManager.CurrentUser.Id, SeriesId = item.SeriesId, SeasonId = item.Id, Fields = FolderPage.QueryFields }, CancellationToken.None)); } var query = new ItemQuery { UserId = _sessionManager.CurrentUser.Id, ParentId = item.Id, Fields = FolderPage.QueryFields }; // Server will sort boxset titles based on server settings if (!item.IsType("boxset")) { query.SortBy = new[] { ItemSortBy.SortName }; query.SortOrder = displayPreferences.SortOrder; } return(_apiClient.GetItemsAsync(query, CancellationToken.None)); }; if (item.IsType("season") && item.IndexNumber.HasValue && item.IndexNumber.Value > 0) { config.DisplayNameGenerator = FolderPage.GetDisplayNameWithAiredSpecial; } } return(config); }
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); }