public Filter(MovieGallery gallery, TitleFilterType filterType, List <TitleFilter> existingFilters) { this.filterType = filterType; this.existingFilters = existingFilters; _gallery = gallery; }
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); }
public Filter(MovieGallery gallery, TitleFilterType filterType, List<TitleFilter> existingFilters) { this.filterType = filterType; this.existingFilters = existingFilters; _gallery = gallery; }
/// <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); }
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"); }
public override GalleryItem Clone(MovieGallery newOwner) { MovieItem m = new MovieItem(_titleObj, newOwner); return m; }
public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory) : this(owner, name, caption, browseCategory, false) { }
public GalleryItem(MovieGallery owner, string name, string caption, Filter browseCategory, int forcedCount) : this(owner, name, caption, browseCategory) { _forcedCount = forcedCount; }
/// <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); } }*/ }
/// <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); }
/// <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); * } * }*/ }
public override GalleryItem Clone(MovieGallery newOwner) { MovieItem m = new MovieItem(_titleObj, newOwner); return(m); }
/// <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)); }
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; }
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"); }