public FolderPage(BaseItemDto parent, DisplayPreferences displayPreferences, IApiClient apiClient, IImageManager imageManager, ISessionManager sessionManager, IPresentationManager presentation, INavigationService navigationManager, IPlaybackManager playbackManager, ILogger logger, IServerEvents serverEvents, ListPageConfig options) { _navigationManager = navigationManager; _playbackManager = playbackManager; _logger = logger; _serverEvents = serverEvents; _presentationManager = presentation; _sessionManager = sessionManager; _imageManager = imageManager; _apiClient = apiClient; _options = options; _displayPreferences = displayPreferences; _parentItem = parent; InitializeComponent(); Loaded += FolderPage_Loaded; Unloaded += FolderPage_Unloaded; SetDefaults(displayPreferences); _viewModel = new ItemListViewModel(GetItemsAsync, _presentationManager, _imageManager, _apiClient, _navigationManager, _playbackManager, _logger, _serverEvents) { ImageDisplayHeightGenerator = GetImageDisplayHeight, DisplayNameGenerator = GetDisplayName, PreferredImageTypesGenerator = GetPreferredImageTypes, ShowSidebarGenerator = GetShowSidebar, ScrollDirectionGenerator = GetScrollDirection, AutoSelectFirstItem = true, ShowLoadingAnimation = true }; _viewModel.AddIndexOptions(options.IndexOptions); _viewModel.PropertyChanged += _viewModel_PropertyChanged; _viewModel.DisplayPreferences = displayPreferences; DataContext = _viewModel; UpdateSortTitle(); UpdateSortOrder(); BtnSort.Visibility = _options.SortOptions.Count > 0 ? Visibility.Visible : Visibility.Collapsed; BtnSort.Click += BtnSort_Click; }
public FolderPage(BaseItemDto parent, DisplayPreferences displayPreferences, IApiClient apiClient, IImageManager imageManager, IPresentationManager presentation, INavigationService navigationManager, IPlaybackManager playbackManager, ILogger logger, ListPageConfig options) { _logger = logger; _presentationManager = presentation; _imageManager = imageManager; _apiClient = apiClient; _options = options; _parentItem = parent; InitializeComponent(); Loaded += FolderPage_Loaded; SetDefaults(displayPreferences); var playAllFromHere = parent.IsType("playlist") || parent.IsType("musicalbum"); _viewModel = new ItemListViewModel(vm => options.CustomItemQuery(vm, displayPreferences), _presentationManager, _imageManager, _apiClient, navigationManager, playbackManager, _logger) { ImageDisplayHeightGenerator = GetImageDisplayHeight, DisplayNameGenerator = options.DisplayNameGenerator ?? GetDisplayName, PreferredImageTypesGenerator = GetPreferredImageTypes, ShowSidebarGenerator = GetShowSidebar, ScrollDirectionGenerator = GetScrollDirection, AutoSelectFirstItem = true, ShowLoadingAnimation = true, PlayAllFromHereOnPlayCommand = playAllFromHere, PlayAllFromHereOnNavigateCommand = playAllFromHere }; _viewModel.AddIndexOptions(options.IndexOptions); _viewModel.PropertyChanged += _viewModel_PropertyChanged; _viewModel.DisplayPreferences = displayPreferences; if (!string.IsNullOrEmpty(options.IndexValue)) { var index = options.IndexOptions.First(i => string.Equals(i.Name, options.IndexValue)); _viewModel.IndexOptionsCollectionView.MoveCurrentTo(index); } DataContext = _viewModel; }