コード例 #1
0
        public Filter(MovieGallery gallery, TitleFilterType filterType, List <TitleFilter> existingFilters)
        {
            this.filterType      = filterType;
            this.existingFilters = existingFilters;

            _gallery = gallery;
        }
コード例 #2
0
        public MovieGallery CreateGallery(string filter)
        {
            Trace.TraceInformation("MovieGallery.CreateFilteredCollection");

            List <TitleFilter> filters;

            if (existingFilters != null)
            {
                filters = new List <TitleFilter>(existingFilters);
            }
            else
            {
                filters = new List <TitleFilter>(1);
            }

            TitleFilter newFilter = new TitleFilter(filterType, filter);

            if (!filters.Contains(newFilter))
            {
                filters.Add(newFilter);
            }

            MovieGallery movies = new MovieGallery(filters);

            movies.SortMovies();

            return(movies);
        }
コード例 #3
0
ファイル: Filters.cs プロジェクト: peeboo/open-media-library
        public Filter(MovieGallery gallery, TitleFilterType filterType, List<TitleFilter> existingFilters)
        {
            this.filterType = filterType;
            this.existingFilters = existingFilters;

            _gallery = gallery;
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GalleryItem"/> class.
        /// </summary>
        public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory, bool watched)
            : base(owner)
        {
            _watched = watched;
            _name = name;
            _sortName = name;
            _caption = caption;
            _owner = owner;
            _category = browseCategory;
            MenuCoverArt = NoCoverImage; // default to NoCoverImage
            //Invoked += ItemSelected;

            _quickPlay = new Command();
            _quickPlay.Invoked += new EventHandler(QuickPlayClicked);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GalleryItem"/> class.
        /// </summary>
        public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory, bool watched)
            : base(owner)
        {
            _watched     = watched;
            _name        = name;
            _sortName    = name;
            _caption     = caption;
            _owner       = owner;
            _category    = browseCategory;
            MenuCoverArt = NoCoverImage; // default to NoCoverImage
            //Invoked += ItemSelected;

            _quickPlay          = new Command();
            _quickPlay.Invoked += new EventHandler(QuickPlayClicked);
        }
コード例 #6
0
        public void BuildSubFilterOptions()
        {
            TitleFilterType filterType = Filter.FilterStringToTitleType(_startPage.Chosen.ToString());

            if (filterType == TitleFilterType.Unwatched ||
                filterType == TitleFilterType.All)
            {
                _startPageSubFilter.Options = new List <string>()
                {
                    ""
                };
                return;
            }

            List <string> subFilters = new List <string>();

            subFilters.Add("");

            // todo : solomon : make this less costly - every new movie gallery
            // instance gets a full list of movies
            MovieGallery gallery = new MovieGallery();

            // get all subfilters for option
            Filter filter = new Filter(gallery, filterType, null);

            IList <GalleryItem> items = filter.GetGalleryItems();

            foreach (GalleryItem item in items)
            {
                subFilters.Add(item.Name);
            }

            _startPageSubFilter = new Choice();

            _startPageSubFilter.Options = subFilters;
            _startPageSubFilter.Chosen  = _startPageSubFilter.Options[0];

            FirePropertyChanged("StartPageSubFilter");
        }
コード例 #7
0
 public override GalleryItem Clone(MovieGallery newOwner)
 {
     MovieItem m = new MovieItem(_titleObj, newOwner);
     return m;
 }
コード例 #8
0
 public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory)
     : this(owner, name, caption, browseCategory, false)
 {
 }
コード例 #9
0
 public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory, int forcedCount)
     : this(owner, name, caption, browseCategory)
 {
     _forcedCount = forcedCount;
 }
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MovieItem"/> class.
        /// </summary>
        /// <param name="title">The title.</param>
        public MovieItem(Title title, MovieGallery owner)
            : base(owner, title.Name, title.Name, null, title.WatchedCount > 0)
        {
            _titleObj = title;
            SortName = title.SortName;
            SubCaption = "";
            if (_titleObj.Runtime > 0)
                SubCaption += Convert.ToString(_titleObj.Runtime) + " minutes";

            if (_titleObj.UserStarRating > 0)
            {
                if (SubCaption.Length > 0) SubCaption += " / ";
                SubCaption += (((double)_titleObj.UserStarRating / 10)).ToString("0.0");
            }

            //            if (_titleObj.Directors.Count > 0 && ((Person)_titleObj.Directors[0]).full_name.Trim().Length > 0)
            //            {
            //                if (SubCaption.Length > 0) SubCaption += " / ";
            //                SubCaption += "Directed by: " + ((Person)_titleObj.Directors[0]).full_name;
            //            }

            if (_titleObj.ParentalRating.Trim().Length > 0)
            {
                if (SubCaption.Length > 0) SubCaption += " / ";
                SubCaption += _titleObj.ParentalRating;
            }

            int genreCount = 0;
            if (_titleObj.Genres.Count > 0)
            {
                foreach (string g in _titleObj.Genres)
                {
                    if (SubCaption.Length > 0) SubCaption += " / ";
                    SubCaption += g;
                    genreCount++;
                    if (genreCount > 3) break;
                }
            }

            //int actorCount = 0;
            //if (_titleObj.ActingRoles.Count > 0)
            //{
            //    SubCaption += "Actors: ";
            //}

            //foreach (KeyValuePair<string,string> actor in _titleObj.ActingRoles)
            //{
            //    if (actor.Key.Trim().Length > 0)
            //    {
            //        if (actorCount > 0)
            //            SubCaption += ", ";

            //        SubCaption += actor.Key.Trim();
            //        actorCount++;

            //        if (actorCount == 6)
            //        {
            //            SubCaption += "...";
            //            break;
            //        }
            //    }
            //}

            //if (_titleObj.ActingRoles.Count > 0)
            //{
            //    SubCaption += "\n";
            //}

            Details = _titleObj.Synopsis;
            /*_actingRoles = new List<string>();

            if (title.ActingRoles.Count > 0)
            {

                foreach (KeyValuePair<string, string> kvp in title.ActingRoles)
                {
                    if (kvp.Value.Trim().Length > 0)
                        _actingRoles.Add(kvp.Key + " as " + kvp.Value);
                    else
                        _actingRoles.Add(kvp.Key);
                }
            }*/
        }
コード例 #11
0
 /// <summary>
 /// A callback that gets called when the item is selected
 /// </summary>
 /// <param name="sender">The sender is a MovieItem.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 //public virtual void ItemSelected(object sender, EventArgs args)
 //{
 //    OMLApplication.ExecuteSafe(delegate
 //    {
 //        GalleryItem galleryItem = (GalleryItem)sender;
 //        if (Gallery != null)
 //        {
 //            if (galleryItem.Name == Filter.AllItems)
 //            {
 //                OMLApplication.Current.GoToMenu(Gallery);
 //            }
 //            else
 //            {
 //                OMLApplication.Current.GoToMenu(Category.CreateGallery(galleryItem.Name));
 //            }
 //        }
 //    });
 //}
 public virtual GalleryItem Clone(MovieGallery newOwner)
 {
     return new GalleryItem(newOwner, Name, Caption, Category, Watched);
 }
コード例 #12
0
 public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory, int forcedCount)
     : this(owner, name, caption, browseCategory)
 {
     _forcedCount = forcedCount;
 }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MovieItem"/> class.
        /// </summary>
        /// <param name="title">The title.</param>
        public MovieItem(Title title, MovieGallery owner)
            : base(owner, title.Name, title.Name, null, title.WatchedCount > 0)
        {
            _titleObj  = title;
            SortName   = title.SortName;
            SubCaption = "";
            if (_titleObj.Runtime > 0)
            {
                SubCaption += Convert.ToString(_titleObj.Runtime) + " minutes";
            }

            if (_titleObj.UserStarRating > 0)
            {
                if (SubCaption.Length > 0)
                {
                    SubCaption += " / ";
                }
                SubCaption += (((double)_titleObj.UserStarRating / 10)).ToString("0.0");
            }

//            if (_titleObj.Directors.Count > 0 && ((Person)_titleObj.Directors[0]).full_name.Trim().Length > 0)
//            {
//                if (SubCaption.Length > 0) SubCaption += " / ";
//                SubCaption += "Directed by: " + ((Person)_titleObj.Directors[0]).full_name;
//            }

            if (_titleObj.ParentalRating.Trim().Length > 0)
            {
                if (SubCaption.Length > 0)
                {
                    SubCaption += " / ";
                }
                SubCaption += _titleObj.ParentalRating;
            }

            int genreCount = 0;

            if (_titleObj.Genres.Count > 0)
            {
                foreach (string g in _titleObj.Genres)
                {
                    if (SubCaption.Length > 0)
                    {
                        SubCaption += " / ";
                    }
                    SubCaption += g;
                    genreCount++;
                    if (genreCount > 3)
                    {
                        break;
                    }
                }
            }

            //int actorCount = 0;
            //if (_titleObj.ActingRoles.Count > 0)
            //{
            //    SubCaption += "Actors: ";
            //}

            //foreach (KeyValuePair<string,string> actor in _titleObj.ActingRoles)
            //{
            //    if (actor.Key.Trim().Length > 0)
            //    {
            //        if (actorCount > 0)
            //            SubCaption += ", ";

            //        SubCaption += actor.Key.Trim();
            //        actorCount++;

            //        if (actorCount == 6)
            //        {
            //            SubCaption += "...";
            //            break;
            //        }
            //    }
            //}


            //if (_titleObj.ActingRoles.Count > 0)
            //{
            //    SubCaption += "\n";
            //}

            Details = _titleObj.Synopsis;

            /*_actingRoles = new List<string>();
             *
             * if (title.ActingRoles.Count > 0)
             * {
             *
             *  foreach (KeyValuePair<string, string> kvp in title.ActingRoles)
             *  {
             *      if (kvp.Value.Trim().Length > 0)
             *          _actingRoles.Add(kvp.Key + " as " + kvp.Value);
             *      else
             *          _actingRoles.Add(kvp.Key);
             *  }
             * }*/
        }
コード例 #14
0
        public override GalleryItem Clone(MovieGallery newOwner)
        {
            MovieItem m = new MovieItem(_titleObj, newOwner);

            return(m);
        }
コード例 #15
0
        /// <summary>
        /// A callback that gets called when the item is selected
        /// </summary>
        /// <param name="sender">The sender is a MovieItem.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        //public virtual void ItemSelected(object sender, EventArgs args)
        //{
        //    OMLApplication.ExecuteSafe(delegate
        //    {
        //        GalleryItem galleryItem = (GalleryItem)sender;

        //        if (Gallery != null)
        //        {
        //            if (galleryItem.Name == Filter.AllItems)
        //            {
        //                OMLApplication.Current.GoToMenu(Gallery);
        //            }
        //            else
        //            {
        //                OMLApplication.Current.GoToMenu(Category.CreateGallery(galleryItem.Name));
        //            }
        //        }
        //    });
        //}

        public virtual GalleryItem Clone(MovieGallery newOwner)
        {
            return(new GalleryItem(newOwner, Name, Caption, Category, Watched));
        }
コード例 #16
0
ファイル: Filters.cs プロジェクト: peeboo/open-media-library
        public MovieGallery CreateGallery(string filter)
        {
            Trace.TraceInformation("MovieGallery.CreateFilteredCollection");

            List<TitleFilter> filters;

            if (existingFilters != null)
                filters = new List<TitleFilter>(existingFilters);
            else
                filters = new List<TitleFilter>(1);

            TitleFilter newFilter = new TitleFilter(filterType, filter);

            if (!filters.Contains(newFilter))
                filters.Add(newFilter);

            MovieGallery movies = new MovieGallery(filters);

            movies.SortMovies();

            return movies;
        }
コード例 #17
0
ファイル: Settings.cs プロジェクト: peeboo/open-media-library
        public void BuildSubFilterOptions()
        {
            TitleFilterType filterType = Filter.FilterStringToTitleType(_startPage.Chosen.ToString());

            if (filterType == TitleFilterType.Unwatched ||
                filterType == TitleFilterType.All)
            {
                _startPageSubFilter.Options = new List<string>() { "" };
                return;
            }

            List<string> subFilters = new List<string>();

            subFilters.Add("");

            // todo : solomon : make this less costly - every new movie gallery
            // instance gets a full list of movies
            MovieGallery gallery = new MovieGallery();

            // get all subfilters for option
            Filter filter = new Filter(gallery, filterType, null);

            IList<GalleryItem> items = filter.GetGalleryItems();

            foreach (GalleryItem item in items)
            {
                subFilters.Add(item.Name);
            }

            _startPageSubFilter = new Choice();

            _startPageSubFilter.Options = subFilters;
            _startPageSubFilter.Chosen = _startPageSubFilter.Options[0];

            FirePropertyChanged("StartPageSubFilter");
        }
コード例 #18
0
 public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory) :
     this(owner, name, caption, browseCategory, false)
 {
 }