本文整理汇总了C#中MediaBrowser.Model.Dto.BaseItemDto.IsType方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItemDto.IsType方法的具体用法?C# BaseItemDto.IsType怎么用?C# BaseItemDto.IsType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Model.Dto.BaseItemDto
的用法示例。
在下文中一共展示了BaseItemDto.IsType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnItemChanged
private void OnItemChanged(ItemViewModel viewModel, BaseItemDto item)
{
UpdateLogo(viewModel, item);
TxtGenres.Visibility = item.Genres.Count > 0 && !item.IsType("episode") && !item.IsType("season") ? Visibility.Visible : Visibility.Collapsed;
TxtGenres.Text = string.Join(" / ", item.Genres.Take(3).ToArray());
}
示例2: 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;
}
示例3: GetListPageConfig
private ListPageConfig GetListPageConfig(BaseItemDto item, ViewType context)
{
var apiClient = _connectionManager.GetApiClient(item);
var config = new ListPageConfig();
if (item.IsType("playlist"))
{
config.DefaultViewType = ListViewTypes.List;
}
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.LocalUserId,
SeriesId = item.Id,
Fields = FolderPage.QueryFields
}, CancellationToken.None);
}
if (item.IsType("season"))
{
return apiClient.GetEpisodesAsync(new EpisodeQuery
{
UserId = _sessionManager.LocalUserId,
SeriesId = item.SeriesId,
SeasonId = item.Id,
Fields = FolderPage.QueryFields
}, CancellationToken.None);
}
var query = new ItemQuery
{
UserId = _sessionManager.LocalUserId,
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;
}
示例4: GetChannelPageConfig
private ListPageConfig GetChannelPageConfig(BaseItemDto item, ViewType context)
{
var apiClient = _connectionManager.GetApiClient(item);
var config = new ListPageConfig();
config.CustomItemQuery = (vm, displayPreferences) =>
{
return GetChannelItems(apiClient, new ChannelItemQuery
{
UserId = _sessionManager.LocalUserId,
ChannelId = item.IsType("channel") ? item.Id : item.ChannelId,
FolderId = item.IsType("channel") ? null : item.Id,
Fields = FolderPage.QueryFields
}, CancellationToken.None);
};
return config;
}
示例5: GetFolderPage
/// <summary>
/// Gets the folder page.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="context">The context.</param>
/// <param name="displayPreferences">The display preferences.</param>
/// <returns>Page.</returns>
public Page GetFolderPage(BaseItemDto item, ViewType context, DisplayPreferences displayPreferences)
{
var apiClient = _connectionManager.GetApiClient(item);
if (item.IsType("channel") || item.IsType("channelfolderitem"))
{
var options = GetChannelPageConfig(item, context);
return new FolderPage(item, displayPreferences, apiClient, _imageManager, _presentationManager, _navService, _playbackManager, _logger, options);
}
if (context == ViewType.Folders || !_folderTypesWithDetailPages.Contains(item.Type, StringComparer.OrdinalIgnoreCase))
{
var options = GetListPageConfig(item, context);
options.ShowTitle = true;
return new FolderPage(item, displayPreferences, apiClient, _imageManager, _presentationManager,
_navService, _playbackManager, _logger, options);
}
return GetItemPage(item, context);
}
示例6: GetDisplayName
public static string GetDisplayName(BaseItemDto item)
{
var name = item.Name;
if (item.IndexNumber.HasValue && !item.IsType("season"))
{
name = item.IndexNumber + " - " + name;
}
if (item.ParentIndexNumber.HasValue && item.IsAudio)
{
name = item.ParentIndexNumber + "." + name;
}
return name;
}
示例7: GetDisplayNameWithAiredSpecial
public static string GetDisplayNameWithAiredSpecial(BaseItemDto item)
{
if (item == null) {
return string.Empty;
}
if (item.IsType("episode") && item.ParentIndexNumber.HasValue && item.ParentIndexNumber.Value == 0) {
return "Special - " + item.Name;
}
return GetDisplayName(item);
}
示例8: UdpateDate
/// <summary>
/// Udpates the date.
/// </summary>
/// <param name="item">The item.</param>
private void UdpateDate(BaseItemDto item)
{
if (item.PremiereDate.HasValue && item.IsType("episode"))
{
TxtDate.Text = item.PremiereDate.Value.ToShortDateString();
PnlDate.Visibility = Visibility.Visible;
return;
}
if (item.ProductionYear.HasValue)
{
TxtDate.Text = item.ProductionYear.Value.ToString();
PnlDate.Visibility = Visibility.Visible;
return;
}
PnlDate.Visibility = Visibility.Collapsed;
}
示例9: GetMenuList
private IEnumerable<TabItem> GetMenuList(BaseItemDto item, QueryResult<ItemReview> reviewsResult)
{
var views = new List<TabItem>
{
new TabItem
{
Name = "overview",
DisplayName = "Overview"
}
};
if (item.ChildCount > 0)
{
if (item.IsType("series"))
{
views.Add(new TabItem
{
Name = "seasons",
DisplayName = "Seasons"
});
}
else if (item.IsType("season"))
{
views.Add(new TabItem
{
Name = "episodes",
DisplayName = "Episodes"
});
}
else if (item.IsType("musicalbum"))
{
views.Add(new TabItem
{
Name = "songs",
DisplayName = "Songs"
});
}
}
if (item.People.Any(i => i.HasPrimaryImage))
{
views.Add(new TabItem
{
Name = "cast",
DisplayName = "Cast"
});
}
if (item.LocalTrailerCount > 1)
{
views.Add(new TabItem
{
Name = "trailers",
DisplayName = "Trailers"
});
}
if (item.Chapters != null && item.Chapters.Count > 0)
{
views.Add(new TabItem
{
Name = "scenes",
DisplayName = "Scenes"
});
}
//if (item.MediaStreams != null && item.MediaStreams.Count > 0)
//{
// views.Add(new TabItem
// {
// Name = "media info",
// DisplayName = "Media Info"
// });
//}
if (item.SpecialFeatureCount > 0)
{
if (item.IsType("series"))
{
views.Add(new TabItem
{
Name = "special features",
DisplayName = "Specials"
});
}
else
{
views.Add(new TabItem
{
Name = "special features",
DisplayName = "Special Features"
});
}
}
if (reviewsResult.TotalRecordCount > 0 || !string.IsNullOrEmpty(item.CriticRatingSummary))
{
views.Add(new TabItem
{
Name = "reviews",
//.........这里部分代码省略.........
示例10: GetDisplayName
internal static string GetDisplayName(BaseItemDto item)
{
var name = item.Name;
if (item.IsType("Episode"))
{
name = item.SeriesName;
if (item.IndexNumber.HasValue && item.ParentIndexNumber.HasValue)
{
name = name + " " + string.Format("S{0}, E{1}", item.ParentIndexNumber.Value, item.IndexNumber.Value);
}
}
return name;
}
示例11: CanPlay
/// <summary>
/// Determines whether this instance can play the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if this instance can play the specified item; otherwise, <c>false</c>.</returns>
public bool CanPlay(BaseItemDto item)
{
if (item.IsType("playlist") || item.IsType("musicalbum") || item.IsType("musicartist") || item.IsType("musicgenre"))
{
return true;
}
if (item.IsFolder)
{
return false;
}
if (string.IsNullOrEmpty(item.MediaType))
{
return false;
}
if (item.LocationType == LocationType.Virtual)
{
return false;
}
if (item.PlayAccess != PlayAccess.Full)
{
return false;
}
PlayerConfiguration config;
var player = GetPlayer(new[] { item }, true, out config);
return player != null;
}
示例12: UpdateClearArt
private async void UpdateClearArt(BaseItemDto item)
{
if (!item.HasArtImage && item.IsType("season"))
{
item = await App.Instance.ApiClient.GetItemAsync(item.SeriesId, App.Instance.CurrentUser.Id);
}
if (item.HasArtImage)
{
ImgDefaultLogo.Source =
await App.Instance.GetRemoteBitmapAsync(App.Instance.ApiClient.GetImageUrl(item, new ImageOptions
{
MaxHeight = 200,
ImageType = ImageType.Art
}));
}
}
示例13: GetDirectoryPath
private List<string> GetDirectoryPath(IServerSyncProvider provider, SyncJob job, SyncedItem syncedItem, BaseItemDto item, string serverName)
{
var parts = new List<string>
{
serverName
};
var profileOption = _syncManager.GetProfileOptions(job.TargetId)
.FirstOrDefault(i => string.Equals(i.Id, job.Profile, StringComparison.OrdinalIgnoreCase));
string name;
if (profileOption != null && !string.IsNullOrWhiteSpace(profileOption.Name))
{
name = profileOption.Name;
if (job.Bitrate.HasValue)
{
name += "-" + job.Bitrate.Value.ToString(CultureInfo.InvariantCulture);
}
else
{
var qualityOption = _syncManager.GetQualityOptions(job.TargetId)
.FirstOrDefault(i => string.Equals(i.Id, job.Quality, StringComparison.OrdinalIgnoreCase));
if (qualityOption != null && !string.IsNullOrWhiteSpace(qualityOption.Name))
{
name += "-" + qualityOption.Name;
}
}
}
else
{
name = syncedItem.SyncJobName + "-" + syncedItem.SyncJobDateCreated
.ToLocalTime()
.ToString("g")
.Replace(" ", "-");
}
name = GetValidFilename(provider, name);
parts.Add(name);
if (item.IsType("episode"))
{
parts.Add("TV");
if (!string.IsNullOrWhiteSpace(item.SeriesName))
{
parts.Add(item.SeriesName);
}
}
else if (item.IsVideo)
{
parts.Add("Videos");
parts.Add(item.Name);
}
else if (item.IsAudio)
{
parts.Add("Music");
if (!string.IsNullOrWhiteSpace(item.AlbumArtist))
{
parts.Add(item.AlbumArtist);
}
if (!string.IsNullOrWhiteSpace(item.Album))
{
parts.Add(item.Album);
}
}
else if (string.Equals(item.MediaType, MediaType.Photo, StringComparison.OrdinalIgnoreCase))
{
parts.Add("Photos");
if (!string.IsNullOrWhiteSpace(item.Album))
{
parts.Add(item.Album);
}
}
return parts.Select(i => GetValidFilename(provider, i)).ToList();
}
示例14: UpdateLogo
private async Task UpdateLogo(BaseItemDto item)
{
if (!item.HasArtImage && item.IsType("episode"))
{
item = await App.Instance.ApiClient.GetItemAsync(item.SeriesId, App.Instance.CurrentUser.Id);
}
// Hide it for movies, for now. It looks really tacky being right under the movie poster
// Creating extra spacing shrinks the poster too much
if (item.HasArtImage && !item.IsType("movie"))
{
ImgLogo.Visibility = Visibility.Visible;
ImgLogo.Source =
await App.Instance.GetRemoteBitmapAsync(App.Instance.ApiClient.GetImageUrl(item, new ImageOptions
{
MaxHeight = 200,
ImageType = ImageType.Art
}));
}
else
{
ImgLogo.Visibility = Visibility.Collapsed;
}
}
示例15: SetTitle
private void SetTitle(BaseItemDto item)
{
if (item.Taglines.Count > 0)
{
TxtName.Text = item.Taglines[0];
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsType("episode"))
{
TxtName.Text = GetEpisodeTitle(item);
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsType("audio"))
{
TxtName.Text = GetSongTitle(item);
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsPerson || item.IsArtist || item.IsGenre || item.IsGameGenre || item.IsMusicGenre || item.IsStudio)
{
TxtName.Text = item.Name;
TxtName.Visibility = Visibility.Visible;
}
else
{
TxtName.Visibility = Visibility.Collapsed;
}
}