当前位置: 首页>>代码示例>>C#>>正文


C# BaseItemDto.IsType方法代码示例

本文整理汇总了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());
        }
开发者ID:Rainking720,项目名称:MediaBrowser.Theater,代码行数:8,代码来源:Sidebar.xaml.cs

示例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;
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:57,代码来源:FolderPage.xaml.cs

示例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;
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:86,代码来源:DefaultTheme.cs

示例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;
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:20,代码来源:DefaultTheme.cs

示例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);
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:29,代码来源:DefaultTheme.cs

示例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;
        }
开发者ID:razorzedge,项目名称:MediaBrowser.Theater,代码行数:16,代码来源:SearchViewModel.cs

示例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);
        }
开发者ID:TomGillen,项目名称:MBT,代码行数:12,代码来源:ItemTileViewModel.cs

示例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;
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.Theater,代码行数:22,代码来源:ItemInfoFooter.xaml.cs

示例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",
//.........这里部分代码省略.........
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:101,代码来源:DetailPageViewModel.cs

示例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;
        }
开发者ID:amoisis,项目名称:MediaBrowser.Theater,代码行数:17,代码来源:HomePageViewModel.cs

示例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;
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:38,代码来源:PlaybackManager.cs

示例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
             }));
     }
 }
开发者ID:EchoDemon,项目名称:MediaBrowser.Theater,代码行数:17,代码来源:ListPage.xaml.cs

示例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();
        }
开发者ID:RavenB,项目名称:Emby,代码行数:81,代码来源:MediaSync.cs

示例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;
            }
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.Theater,代码行数:25,代码来源:DetailPage.xaml.cs

示例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;
     }
 }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:27,代码来源:DetailPage.xaml.cs


注:本文中的MediaBrowser.Model.Dto.BaseItemDto.IsType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。