本文整理汇总了C#中MediaBrowser.Theater.Presentation.ViewModels.ItemListViewModel类的典型用法代码示例。如果您正苦于以下问题:C# ItemListViewModel类的具体用法?C# ItemListViewModel怎么用?C# ItemListViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemListViewModel类属于MediaBrowser.Theater.Presentation.ViewModels命名空间,在下文中一共展示了ItemListViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FolderPage
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
};
if (options.ShowTitle)
{
_viewModel.OnItemCreated = v =>
{
v.DisplayNameVisibility = Visibility.Visible;
};
}
_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;
}
示例2: FolderPage
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;
}
示例3: FolderPage
public FolderPage(BaseItemDto parent, DisplayPreferences displayPreferences, IApiClient apiClient, IImageManager imageManager, IPresentationManager presentation, INavigationService navigationManager, IPlaybackManager playbackManager, ILogger logger, IServerEvents serverEvents, ListPageConfig options)
{
_logger = logger;
_presentationManager = presentation;
_imageManager = imageManager;
_apiClient = apiClient;
_options = options;
_parentItem = parent;
InitializeComponent();
Loaded += FolderPage_Loaded;
SetDefaults(displayPreferences);
_viewModel = new ItemListViewModel(vm => options.CustomItemQuery(vm, displayPreferences), _presentationManager, _imageManager, _apiClient, navigationManager, playbackManager, _logger, serverEvents)
{
ImageDisplayHeightGenerator = GetImageDisplayHeight,
DisplayNameGenerator = options.DisplayNameGenerator ?? GetDisplayName,
PreferredImageTypesGenerator = GetPreferredImageTypes,
ShowSidebarGenerator = GetShowSidebar,
ScrollDirectionGenerator = GetScrollDirection,
AutoSelectFirstItem = true,
ShowLoadingAnimation = true
};
_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;
}
示例4: LoadMatchedItemsViewModel
private void LoadMatchedItemsViewModel()
{
MatchedItemsViewModel = new ItemListViewModel(s => Task.FromResult(_searchedItemsResult), _presentationManager, _imageManager, _apiClient, _navService, _playbackManager, _logger, _serverEvents)
{
ImageDisplayWidth = TileWidth,
ImageDisplayHeightGenerator = vm => TileHeight,
DisplayNameGenerator = GetDisplayName,
PreferredImageTypesGenerator = vm => new[] { ImageType.Thumb, ImageType.Primary }, // vm => _preferredImageTypes,
ScrollDirection = ScrollDirection.Horizontal,
EnableBackdropsForCurrentItem = false,
ShowSidebar = false,
AutoSelectFirstItem = false,
ShowLoadingAnimation = true,
IsVirtualizationRequired= false,
};
MatchedItemsViewModel.ItemContainerWidth = TileWidth + 5;
MatchedItemsViewModel.ItemContainerHeight = TileHeight + 5;
OnPropertyChanged("MatchedItemsViewModel");
}
示例5: GetSeriesByGenre
private Task<ItemsResult> GetSeriesByGenre(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
{
var query = new ItemQuery
{
Fields = FolderPage.QueryFields,
UserId = _sessionManager.LocalUserId,
IncludeItemTypes = new[] { "Series" },
SortBy = !String.IsNullOrEmpty(displayPreferences.SortBy)
? new[] { displayPreferences.SortBy }
: new[] { ItemSortBy.SortName },
SortOrder = displayPreferences.SortOrder,
Recursive = true,
ParentId = ParentId
};
var indexOption = viewModel.CurrentIndexOption;
if (indexOption != null)
{
query.Genres = new[] { indexOption.Name };
}
return ApiClient.GetItemsAsync(query, CancellationToken.None);
}
示例6: LoadNextUpViewModel
private void LoadNextUpViewModel(TvView view)
{
NextUpViewModel = new ItemListViewModel(GetNextUpAsync, PresentationManager, _imageManager, ApiClient, _navService, _playbackManager, _logger)
{
ImageDisplayWidth = TileWidth,
ImageDisplayHeightGenerator = v => TileHeight,
DisplayNameGenerator = i => i.SeriesName,
EnableBackdropsForCurrentItem = false,
EnableServerImageEnhancers = false,
OnItemCreated = vm =>
{
vm.DisplayNameVisibility = Visibility.Visible;
}
};
OnPropertyChanged("NextUpViewModel");
}
示例7: LoadLatestEpisodesViewModel
private void LoadLatestEpisodesViewModel(TvView view)
{
LatestEpisodesViewModel = new ItemListViewModel(GetLatestEpisodes, PresentationManager, _imageManager, ApiClient, _navService, _playbackManager, _logger, _serverEvents)
{
ImageDisplayWidth = TileWidth,
ImageDisplayHeightGenerator = v => TileHeight,
DisplayNameGenerator = HomePageViewModel.GetDisplayName,
EnableBackdropsForCurrentItem = false,
EnableServerImageEnhancers = false,
OnItemCreated = vm =>
{
vm.DisplayNameVisibility = Visibility.Visible;
}
};
OnPropertyChanged("LatestEpisodesViewModel");
}
示例8: GetAlbumSongs
private Task<ItemsResult> GetAlbumSongs(ItemListViewModel viewModel)
{
var item = ItemViewModel.Item;
var query = new ItemQuery
{
UserId = _sessionManager.LocalUserId,
Fields = new[]
{
ItemFields.PrimaryImageAspectRatio,
ItemFields.DateCreated,
ItemFields.Overview
},
ParentId = item.Id,
SortBy = new[] { ItemSortBy.SortName },
Recursive = true,
IncludeItemTypes = new[] { "Audio" }
};
return _apiClient.GetItemsAsync(query, CancellationToken.None);
}
示例9: GetSeasons
private Task<ItemsResult> GetSeasons(ItemListViewModel viewModel)
{
var item = ItemViewModel.Item;
var query = new SeasonQuery
{
UserId = _sessionManager.LocalUserId,
Fields = new[]
{
ItemFields.PrimaryImageAspectRatio,
ItemFields.DateCreated,
ItemFields.Overview
},
SeriesId = item.Id
};
return _apiClient.GetSeasonsAsync(query, CancellationToken.None);
}
示例10: GetSoundtracks
private Task<ItemsResult> GetSoundtracks(ItemListViewModel viewModel)
{
var item = ItemViewModel.Item;
var query = new ItemQuery
{
UserId = _sessionManager.LocalUserId,
Fields = new[]
{
ItemFields.PrimaryImageAspectRatio,
ItemFields.DateCreated
},
Ids = item.SoundtrackIds,
SortBy = new[] { ItemSortBy.SortName }
};
return _apiClient.GetItemsAsync(query, CancellationToken.None);
}
示例11: GetMovies
private Task<ItemsResult> GetMovies(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
{
var query = new ItemQuery
{
Fields = FolderPage.QueryFields,
UserId = _sessionManager.CurrentUser.Id,
IncludeItemTypes = new[] { "Movie" },
SortBy = !String.IsNullOrEmpty(displayPreferences.SortBy)
? new[] { displayPreferences.SortBy }
: new[] { ItemSortBy.SortName },
SortOrder = displayPreferences.SortOrder,
Recursive = true
};
var indexOption = viewModel.CurrentIndexOption == null ? string.Empty : viewModel.CurrentIndexOption.Name;
if (string.Equals(indexOption, "TopRated"))
{
query.MinCommunityRating = ApiClientExtensions.TopMovieCommunityRating;
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "Unwatched"))
{
query.Filters = new[] { ItemFilter.IsUnplayed };
}
else if (string.Equals(indexOption, "NewReleases"))
{
query.SortBy = new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate };
query.SortOrder = SortOrder.Descending;
query.Limit = 100;
}
else if (string.Equals(indexOption, "HDMovies"))
{
query.IsHD = true;
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "3DMovies"))
{
query.Is3D = true;
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "Trailers"))
{
query.IncludeItemTypes = new[] { "Trailer" };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "BoxSets"))
{
query.IncludeItemTypes = new[] { "BoxSet" };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "FavoriteMovies"))
{
query.Filters = new[] { ItemFilter.IsFavorite };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "TopCriticRated"))
{
query.MinCriticRating = 95;
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (string.Equals(indexOption, "Family"))
{
query.Genres = new[] { "Family" };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (indexOption.StartsWith("Genre:"))
{
query.Genres = new[] { indexOption.Split(':').Last() };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
}
else if (indexOption.StartsWith("Studio:"))
{
query.Studios = new[] { indexOption.Split(':').Last() };
query.SortBy = new[] { ItemSortBy.SortName };
query.SortOrder = SortOrder.Ascending;
//.........这里部分代码省略.........
示例12: GetLatestMoviesAsync
private Task<ItemsResult> GetLatestMoviesAsync(ItemListViewModel viewModel)
{
var result = new ItemsResult
{
Items = _moviesView.LatestMovies.ToArray(),
TotalRecordCount = _moviesView.LatestMovies.Count
};
return Task.FromResult(result);
}
示例13: LoadLatestTrailersViewModel
private void LoadLatestTrailersViewModel(MoviesView view)
{
LatestTrailersViewModel = new ItemListViewModel(GetLatestTrailersAsync, PresentationManager, _imageManager, ApiClient, _navService, _playbackManager, _logger, _serverEvents)
{
ImageDisplayWidth = _posterTileWidth,
ImageDisplayHeightGenerator = v => _posterTileHeight,
DisplayNameGenerator = HomePageViewModel.GetDisplayName,
PreferredImageTypesGenerator = vm => new[] { ImageType.Primary },
EnableBackdropsForCurrentItem = false
};
OnPropertyChanged("LatestTrailersViewModel");
LatestTrailersVisibility = view.TrailerItems.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
}
示例14: GetChildren
private Task<ItemsResult> GetChildren(ItemListViewModel viewModel)
{
var item = ItemViewModel.Item;
var query = new ItemQuery
{
UserId = _sessionManager.CurrentUser.Id,
Fields = new[]
{
ItemFields.PrimaryImageAspectRatio,
ItemFields.DateCreated,
ItemFields.Overview
},
ParentId = item.Id,
SortBy = new[] { ItemSortBy.SortName }
};
return _apiClient.GetItemsAsync(query, CancellationToken.None);
}
示例15: GetSeasons
private Task<ItemsResult> GetSeasons(ItemListViewModel viewModel)
{
var item = ItemViewModel.Item;
var query = new SeasonQuery
{
UserId = _sessionManager.CurrentUser.Id,
Fields = new[]
{
ItemFields.PrimaryImageAspectRatio,
ItemFields.DateCreated,
ItemFields.Overview
},
SeriesId = item.Id,
IsSpecialSeason = false
};
return _apiClient.GetSeasonsAsync(query);
}