예제 #1
0
 public int CompareTo(object obj)
 {
     if (obj is GalleryItem)
     {
         GalleryItem item = (GalleryItem)obj;
         return(_name.CompareTo(item._name));
     }
     else
     {
         throw new ArgumentException("object is not a GalleryItem");
     }
 }
예제 #2
0
        /// <summary>
        /// Finishes any slow data for a gallery item.
        /// </summary>
        private void CompleteGalleryItem(VirtualList list, int index)
        {
            MovieItem item = (MovieItem)list[index];

            if (item.LoadedCover)
            {
                return;
            }

            //if (item.MenuCoverArt != MovieItem.NoCoverImage)
            //  return;

            Image image = null;

            // too many threads started, kills the system
            //Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(delegate
            //{
            try
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], load menu art", index, item.Name);
                string imageFile = OMLSettings.UseOriginalCoverArt
                    ? item.TitleObject.FrontCoverPath
                    : item.TitleObject.FrontCoverMenuPath;
                if (!string.IsNullOrEmpty(imageFile) && File.Exists(imageFile))
                {
                    image = GalleryItem.LoadImage(imageFile);
                }
            }
            catch (Exception e)
            {
                OMLApplication.DebugLine("[MovieGallery] Error: {0}\n    {1}", e.Message, e.StackTrace);
            }
            //}, delegate
            //{
            if (image != null)
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], set menu art", index, item.Name);
                item.MenuCoverArt = image;
                item.LoadedCover  = true;
            }
            //}, null);
        }
예제 #3
0
        private void LoadDetails(MovieItem item)
        {
            // get the title from the db will full information
            Title title = OMLEngine.TitleCollectionManager.GetTitle(item.TitleObject.Id);

            // create a new movie item to use
            _movieDetails = new MovieItem(title, item.Gallery);

            //_localMedia = null;

            //DVDDiskInfo debug code
            //if (item.TitleObject.Disks.Count > 0)
            //{
            //    DVDDiskInfo info = item.TitleObject.Disks[0].DVDDiskInfo;
            //}

            if (!string.IsNullOrEmpty(item.TitleObject.FrontCoverPath))
            {
                if (File.Exists(item.TitleObject.FrontCoverPath))
                {
                    _fullCover = GalleryItem.LoadImage(item.TitleObject.FrontCoverPath);
                }
            }
            _diskChoice = new Choice();
            if (_movieDetails.Disks.Count > 0)
            {
                _diskChoice.Options = _movieDetails.FriendlyNamedDisks;
            }
            else
            {
                Disk[] temp = { new Disk() };
                temp[0].Name        = "Play Me";
                _diskChoice.Options = temp; // MCE barfs if Options is bound to empty List.
                OMLApplication.DebugLine("[MovieDetailsPage] Details Page.LoadMovies: no disks");
            }

            _watched.Chosen = (_movieDetails.TitleObject.WatchedCount != 0);

            SetupCastObjects();
        }
예제 #4
0
        public IList<GalleryItem> GetGalleryItems()
        {
            List<GalleryItem> items = new List<GalleryItem>();
            //items.Add(new GalleryItem(_gallery, AllItems, AllItems, this));

            IEnumerable<FilteredCollection> filteredItems = null;

            switch (filterType)
            {
                case TitleFilterType.Genre:
                    filteredItems = TitleCollectionManager.GetAllGenres(existingFilters);
                    //IEnumerable<FilteredCollectionWithImages> fc = TitleCollectionManager.GetAllGenresWithImages(existingFilters);
                    //foreach (FilteredCollectionWithImages gen in fc)
                    //{

                    //}
                    break;

                case TitleFilterType.ParentalRating:
                    filteredItems = TitleCollectionManager.GetAllParentalRatings(existingFilters);
                    break;

                case TitleFilterType.VideoFormat:
                    filteredItems = TitleCollectionManager.GetAllVideoFormats(existingFilters);
                    break;

                case TitleFilterType.Runtime:
                    filteredItems = TitleCollectionManager.GetAllRuntimes(existingFilters);
                    break;

                case TitleFilterType.Year:
                    filteredItems = TitleCollectionManager.GetAllYears(existingFilters);
                    break;

                case TitleFilterType.Country:
                    filteredItems = TitleCollectionManager.GetAllCountries(existingFilters);
                    break;

                case TitleFilterType.Tag:
                    filteredItems = TitleCollectionManager.GetAllTags(existingFilters);
                    break;

                case TitleFilterType.Director:
                    filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Director);
                    break;

                case TitleFilterType.Actor:
                    filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Actor);
                    break;

                case TitleFilterType.UserRating:
                    filteredItems = TitleCollectionManager.GetAllUserRatings(existingFilters);
                    break;

                case TitleFilterType.DateAdded:
                    filteredItems = TitleCollectionManager.GetAllDateAdded(existingFilters);
                    break;

                default:
                    throw new ArgumentException("Unknown filter type");
            }

            if (filteredItems != null)
            {
                foreach (FilteredCollection item in filteredItems)
                {
                    GalleryItem galleryItem = new GalleryItem(_gallery, item.Name, item.Name, this, item.Count);
                    if (!string.IsNullOrEmpty(item.ImagePath))
                    {
                        //TODO:ASYNC this
                        galleryItem.MenuCoverArt = MovieItem.LoadImage(item.ImagePath);
                    }

                    items.Add(galleryItem);
                }
            }

            return items;
        }
예제 #5
0
        public IList <GalleryItem> GetGalleryItems()
        {
            List <GalleryItem> items = new List <GalleryItem>();
            //items.Add(new GalleryItem(_gallery, AllItems, AllItems, this));

            IEnumerable <FilteredCollection> filteredItems = null;

            switch (filterType)
            {
            case TitleFilterType.Genre:
                filteredItems = TitleCollectionManager.GetAllGenres(existingFilters);
                //IEnumerable<FilteredCollectionWithImages> fc = TitleCollectionManager.GetAllGenresWithImages(existingFilters);
                //foreach (FilteredCollectionWithImages gen in fc)
                //{

                //}
                break;

            case TitleFilterType.ParentalRating:
                filteredItems = TitleCollectionManager.GetAllParentalRatings(existingFilters);
                break;

            case TitleFilterType.VideoFormat:
                filteredItems = TitleCollectionManager.GetAllVideoFormats(existingFilters);
                break;

            case TitleFilterType.Runtime:
                filteredItems = TitleCollectionManager.GetAllRuntimes(existingFilters);
                break;

            case TitleFilterType.Year:
                filteredItems = TitleCollectionManager.GetAllYears(existingFilters);
                break;

            case TitleFilterType.Country:
                filteredItems = TitleCollectionManager.GetAllCountries(existingFilters);
                break;

            case TitleFilterType.Tag:
                filteredItems = TitleCollectionManager.GetAllTags(existingFilters);
                break;

            case TitleFilterType.Director:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Director);
                break;

            case TitleFilterType.Actor:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Actor);
                break;

            case TitleFilterType.UserRating:
                filteredItems = TitleCollectionManager.GetAllUserRatings(existingFilters);
                break;

            case TitleFilterType.DateAdded:
                filteredItems = TitleCollectionManager.GetAllDateAdded(existingFilters);
                break;

            default:
                throw new ArgumentException("Unknown filter type");
            }

            if (filteredItems != null)
            {
                foreach (FilteredCollection item in filteredItems)
                {
                    GalleryItem galleryItem = new GalleryItem(_gallery, item.Name, item.Name, this, item.Count);
                    if (!string.IsNullOrEmpty(item.ImagePath))
                    {
                        //TODO:ASYNC this
                        galleryItem.MenuCoverArt = MovieItem.LoadImage(item.ImagePath);
                    }

                    items.Add(galleryItem);
                }
            }

            return(items);
        }