Пример #1
0
        private async Task NavigateToItemInternal(BaseItemDto item, ViewType context)
        {
            var apiClient = _connectionManager.GetApiClient(item);

            // Grab it fresh from the server to make sure we have the full record
            item = await apiClient.GetItemAsync(item.Id, apiClient.CurrentUserId);

            if (item.IsFolder)
            {
                DisplayPreferences displayPreferences;

                try
                {
                    displayPreferences = await _presentationManager.GetDisplayPreferences(item.DisplayPreferencesId, CancellationToken.None);
                }
                catch
                {
                    // Already logged at lower levels
                    displayPreferences = new DisplayPreferences
                    {
                        Id = item.DisplayPreferencesId
                    };
                }

                await App.Instance.ApplicationWindow.Dispatcher.InvokeAsync(async() => await Navigate(_themeManager.CurrentTheme.GetFolderPage(item, context, displayPreferences)));
            }
            else
            {
                await App.Instance.ApplicationWindow.Dispatcher.InvokeAsync(async() => await Navigate(_themeManager.CurrentTheme.GetItemPage(item, context)));
            }
        }
        private async Task NavigateToAllShowsInternal()
        {
            var item = await _apiClient.GetRootFolderAsync(_sessionManager.CurrentUser.Id);

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

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

            TvViewModel.SetDefaults(options);

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

            await _nav.Navigate(page);
        }