Пример #1
0
        private static int SortByDateAddedDescending(MovieItem m1, MovieItem m2)
        {
            int compare = m1.TitleObject.DateAdded.CompareTo(m2.TitleObject.DateAdded);

            if (compare == 0)
            {
                return(SortByNameAscending(m1, m2));
            }
            else
            {
                return(-compare);
            }
        }
Пример #2
0
        private static int SortByYearDescending(MovieItem m1, MovieItem m2)
        {
            int compare = m1.TitleObject.ReleaseDate.CompareTo(m2.TitleObject.ReleaseDate);

            if (compare == 0)
            {
                return(SortByNameAscending(m1, m2));
            }
            else
            {
                return(-compare);
            }
        }
Пример #3
0
 private static int SortByUserRatingDescending(MovieItem m1, MovieItem m2)
 {
     if (m1.TitleObject.UserStarRating > m2.TitleObject.UserStarRating)
     {
         return(-1);
     }
     else if (m1.TitleObject.UserStarRating < m2.TitleObject.UserStarRating)
     {
         return(1);
     }
     else
     {
         return(SortByNameAscending(m1, m2));
     }
 }
Пример #4
0
 private static int SortByRuntimeAscending(MovieItem m1, MovieItem m2)
 {
     if (m1.TitleObject.Runtime > m2.TitleObject.Runtime)
     {
         return(1);
     }
     else if (m1.TitleObject.Runtime < m2.TitleObject.Runtime)
     {
         return(-1);
     }
     else
     {
         return(SortByNameAscending(m1, m2));
     }
 }
Пример #5
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);
        }
Пример #6
0
        /// <summary>
        /// Handles the play or plause/pause button when click from the top level menu to immediately
        /// play disk 1.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QuickPlayClicked(object sender, EventArgs e)
        {
            OMLApplication.ExecuteSafe(delegate
            {
                // quick play is only allowed if we're a movie item
                // this needs a cast here because in MCML movieitems are used
                // as gallery items
                MovieItem movie = this as MovieItem;

                // make sure we have a disk to quick play
                if (movie != null &&
                    movie.Disks != null &&
                    movie.Disks.Count > 0 &&
                    movie.TitleObject != null)
                {
                    // play the first disk
                    movie.TitleObject.SelectedDisk = movie.Disks[0];
                    movie.PlayMovie();
                }
            });
        }
Пример #7
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();
        }
Пример #8
0
 public MovieDetailsPage(MovieItem item)
 {
     LoadDetails(item);
     SetBackgroundImage();
 }
Пример #9
0
 private static int SortByUserRatingDescending(MovieItem m1, MovieItem m2)
 {
     if (m1.TitleObject.UserStarRating > m2.TitleObject.UserStarRating)
         return -1;
     else if (m1.TitleObject.UserStarRating < m2.TitleObject.UserStarRating)
         return 1;
     else
         return SortByNameAscending(m1, m2);
 }
Пример #10
0
 private static int SortByYearDescending(MovieItem m1, MovieItem m2)
 {
     int compare = m1.TitleObject.ReleaseDate.CompareTo(m2.TitleObject.ReleaseDate);
     if (compare == 0)
         return SortByNameAscending(m1, m2);
     else
         return -compare;
 }
Пример #11
0
 private static int SortByNameDescending(MovieItem m1, MovieItem m2)
 {
     return -SortByNameAscending(m1, m2);
 }
Пример #12
0
 private static int SortByRuntimeDescending(MovieItem m1, MovieItem m2)
 {
     if (m1.TitleObject.Runtime > m2.TitleObject.Runtime)
         return -1;
     else if (m1.TitleObject.Runtime < m2.TitleObject.Runtime)
         return 1;
     else
         return SortByNameAscending(m1, m2);
 }
Пример #13
0
        public override GalleryItem Clone(MovieGallery newOwner)
        {
            MovieItem m = new MovieItem(_titleObj, newOwner);

            return(m);
        }
Пример #14
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();
        }
Пример #15
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);
        }
Пример #16
0
 private static int SortByNameAscending(MovieItem m1, MovieItem m2)
 {
     return(m1.SortName.CompareTo(m2.SortName));
 }
Пример #17
0
 private static int SortByNameDescending(MovieItem m1, MovieItem m2)
 {
     return(-SortByNameAscending(m1, m2));
 }
Пример #18
0
 public MovieDetailsPage(MovieItem item)
 {
     LoadDetails(item);
     SetBackgroundImage();
 }
Пример #19
0
 private static int SortByDateAddedDescending(MovieItem m1, MovieItem m2)
 {
     int compare = m1.TitleObject.DateAdded.CompareTo(m2.TitleObject.DateAdded);
     if (compare == 0)
         return SortByNameAscending(m1, m2);
     else
         return -compare;
 }
Пример #20
0
 public override GalleryItem Clone(MovieGallery newOwner)
 {
     MovieItem m = new MovieItem(_titleObj, newOwner);
     return m;
 }
Пример #21
0
 private static int SortByNameAscending(MovieItem m1, MovieItem m2)
 {
     return m1.SortName.CompareTo(m2.SortName);
 }