private void CreatePivots() { titlePivot = new Library.Code.V3.BrowsePivot(this, "title", "No titles were found.", new VirtualList(this, null)); titlePivot.ContentLabel = this.Description; titlePivot.SetupContextMenu(); titlePivot.LoadingContentMessage = "Loading trailers..."; titlePivot.SupportsJIL = false; titlePivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; titlePivot.ContentItemTemplate = "oneRowGalleryItemPoster"; titlePivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; titlePivot.IsBusy = true; this.Model.Pivots.Options.Add(titlePivot); //setting this as the default chosen pivot this.Model.Pivots.Chosen = titlePivot; dateAddedPivot = new Library.Code.V3.BrowsePivot(this, "date added", "No titles were found.", new VirtualList(this, null)); dateAddedPivot.ContentLabel = this.Description; dateAddedPivot.SetupContextMenu(); dateAddedPivot.LoadingContentMessage = "Loading trailers..."; dateAddedPivot.SupportsJIL = false; dateAddedPivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; dateAddedPivot.ContentItemTemplate = "oneRowGalleryItemPoster"; dateAddedPivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; dateAddedPivot.IsBusy = true; this.Model.Pivots.Options.Add(dateAddedPivot); genrePivot = new Library.Code.V3.BrowsePivot(this, "genres", "No titles were found.", new VirtualList(this, null)); genrePivot.ContentLabel = this.Description; genrePivot.SetupContextMenu(); genrePivot.LoadingContentMessage = "Loading trailers..."; genrePivot.SupportsJIL = true; genrePivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; genrePivot.ContentItemTemplate = "ListViewItem"; genrePivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; genrePivot.IsBusy = true; this.Model.Pivots.Options.Add(genrePivot); }
//gotta remove this-fired only from actor invoke on movieitem public GalleryPage(System.Collections.Generic.IEnumerable<OMLEngine.Title> _titles, string galleryName) : this() { #region v3POC //SetPrimaryBackgroundImage(); //OMLEngine.TitleCollection _titles = new OMLEngine.TitleCollection(); //_titles.loadTitleCollection(); //primaryBackgroundImage //this is temp to test controls OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); //properties.Add("UISettings", new UISettings()); //properties.Add("Settings", new Library.Settings()); properties.Add("I18n", I18n.Instance); //v3 main gallery Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(); //description gallery.Description = galleryName; //size of the galleryitems //DEPRECATED //gallery.ItemSize = Library.Code.V3.GalleryItemSize.Small; gallery.Model = new Library.Code.V3.BrowseModel(gallery); //commands at top of screen gallery.Model.Commands = new ArrayListDataSet(gallery); //create the context menu //Library.Code.V3.ContextMenuData ctx = new Library.Code.V3.ContextMenuData(); //create the settings cmd Library.Code.V3.ThumbnailCommand settingsCmd = new Library.Code.V3.ThumbnailCommand(gallery); settingsCmd.Description = "settings"; settingsCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings"); settingsCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings_Dormant"); settingsCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings_Focus"); //no invoke for now //settingsCmd.Invoked += new EventHandler(settingsCmd_Invoked); gallery.Model.Commands.Add(settingsCmd); //create the Search cmd Library.Code.V3.ThumbnailCommand searchCmd = new Library.Code.V3.ThumbnailCommand(gallery); searchCmd.Description = "search"; searchCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search"); searchCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search_Dormant"); searchCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search_Focus"); //searchCmd.Invoked += new EventHandler(searchCmd_Invoked); gallery.Model.Commands.Add(searchCmd); ////some ctx items //Library.Code.V3.ThumbnailCommand viewListCmd = new Library.Code.V3.ThumbnailCommand(gallery); //viewListCmd.Description = "View List"; ////viewListCmd.Invoked += new EventHandler(viewCmd_Invoked); //Library.Code.V3.ThumbnailCommand viewSmallCmd = new Library.Code.V3.ThumbnailCommand(gallery); ////viewSmallCmd.Invoked += new EventHandler(viewCmd_Invoked); //viewSmallCmd.Description = "View Small"; //Library.Code.V3.ThumbnailCommand viewLargeCmd = new Library.Code.V3.ThumbnailCommand(gallery); ////viewLargeCmd.Invoked += new EventHandler(viewCmd_Invoked); //viewLargeCmd.Description = "View Large"; //Library.Code.V3.ThumbnailCommand viewSettingsCmd = new Library.Code.V3.ThumbnailCommand(gallery); ////viewSettingsCmd.Invoked += new EventHandler(this.SettingsHandler); //viewSettingsCmd.Description = "Settings"; ////ctx.SharedItems.Add(viewLargeCmd); //ctx.SharedItems.Add(viewSmallCmd); //ctx.SharedItems.Add(viewListCmd); //ctx.SharedItems.Add(viewSettingsCmd); //Library.Code.V3.ThumbnailCommand viewMovieDetailsCmd = new Library.Code.V3.ThumbnailCommand(gallery); //viewMovieDetailsCmd.Description = "Movie Details"; //Library.Code.V3.ThumbnailCommand viewPlayCmd = new Library.Code.V3.ThumbnailCommand(gallery); //viewPlayCmd.Description = "Play"; //Library.Code.V3.ThumbnailCommand viewDeleteCmd = new Library.Code.V3.ThumbnailCommand(gallery); //viewDeleteCmd.Description = "Delete"; //ctx.UniqueItems.Add(viewMovieDetailsCmd); //ctx.UniqueItems.Add(viewPlayCmd); //ctx.UniqueItems.Add(viewDeleteCmd); Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); //properties.Add("MenuData", ctx); //gallery.ContextMenu = ctx; //the pivots gallery.Model.Pivots = new Choice(gallery, "desc", new ArrayListDataSet(gallery)); //twoRowChangerData //#region oneRowChangerData //if (this.mediaChangers != null && this.mediaChangers.KnownDiscs.Count > 0) //{ // VirtualList changerGalleryList = new VirtualList(gallery, null); // foreach (Library.Code.V3.DiscDataEx t in this.mediaChangers.KnownDiscs) // { // //galleryList.Add(this.CreateGalleryItem(t)); // if (t.DiscType == DiscType.MovieDvd) // changerGalleryList.Add(new Library.Code.V3.DVDChangerItem(t, changerGalleryList)); // } // Library.Code.V3.BrowsePivot changerPivot = new Library.Code.V3.BrowsePivot(gallery, "changer", "loading titles...", changerGalleryList); // changerPivot.ContentLabel = "OML"; // changerPivot.SupportsJIL = true; // changerPivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; // changerPivot.ContentItemTemplate = "oneRowGalleryItemPoster"; // changerPivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; // gallery.Model.Pivots.Options.Add(changerPivot); //} //#endregion oneRowChangerData //twoRowGalleryItemPoster #region oneRowGalleryItemPoster VirtualList galleryList = new VirtualList(gallery, null); foreach (OMLEngine.Title t in _titles) { //galleryList.Add(this.CreateGalleryItem(t)); galleryList.Add(new Library.Code.V3.MovieItem(t, galleryList)); } Library.Code.V3.BrowsePivot p = new Library.Code.V3.BrowsePivot(gallery, "one row", "loading titles...", galleryList); p.ContentLabel = galleryName; p.SupportsJIL = true; p.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; p.ContentItemTemplate = "oneRowGalleryItemPoster"; p.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; gallery.Model.Pivots.Options.Add(p); #endregion oneRowGalleryItemPoster ////twoRowGalleryItemPoster //#region twoRowGalleryItemPoster //VirtualList galleryListGenres = new VirtualList(gallery, null); //foreach (OMLEngine.Title t in _titles) //{ // galleryListGenres.Add(new Library.Code.V3.MovieItem(t, galleryListGenres)); //} //Library.Code.V3.BrowsePivot p2 = new Library.Code.V3.BrowsePivot(gallery, "two row", "loading genres...", galleryListGenres); //p2.ContentLabel = galleryName; //p2.SupportsJIL = true; //p2.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; //p2.ContentItemTemplate = "twoRowGalleryItemPoster"; //p2.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate; //gallery.Model.Pivots.Options.Add(p2); //#endregion twoRowGalleryItemPoster ////ListViewItem //#region ListViewItem //VirtualList galleryListListViewItem = new VirtualList(gallery, null); //foreach (OMLEngine.Title t in _titles) //{ // galleryListListViewItem.Add(new Library.Code.V3.MovieItem(t, galleryListListViewItem)); //} //Library.Code.V3.BrowsePivot p3 = new Library.Code.V3.BrowsePivot(gallery, "list", "loading genres...", galleryListListViewItem); //p3.ContentLabel = galleryName; //p3.SupportsJIL = true; //p3.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; //p3.ContentItemTemplate = "ListViewItem"; //p3.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate; //gallery.Model.Pivots.Options.Add(p3); //#endregion ListViewItem ////Grouped //#region Grouped //VirtualList groupedGalleryListListViewItem = new VirtualList(gallery, null); //int i = 1; //foreach (OMLEngine.Title t in _titles) //{ // i++; // groupedGalleryListListViewItem.Add(new Library.Code.V3.MovieItem(t, groupedGalleryListListViewItem)); // if (i > 20) // break; //} //Library.Code.V3.GalleryItem testtgenre = new Library.Code.V3.GalleryItem(); //testtgenre.Description = "Comedy"; //testtgenre.Metadata = "12 titles"; //testtgenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_comedy"); ////groupedGalleryListListViewItem.Add(testtgenre); //Library.Code.V3.BrowseGroup testGroup = new Library.Code.V3.BrowseGroup();//this, "Sample Group", groupedGalleryListListViewItem); //testGroup.Owner = gallery; //testGroup.Description = "Group 1"; //testGroup.Metadata = "12 titles"; //testGroup.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery"); //testGroup.Content = groupedGalleryListListViewItem; //testGroup.ContentLabelTemplate = Library.Code.V3.BrowseGroup.StandardContentLabelTemplate; //VirtualList groupListView = new VirtualList(gallery, null); ////groupListView.Add(testtgenre); //groupListView.Add(testGroup); //VirtualList groupedGalleryListListViewItem2 = new VirtualList(gallery, null); //foreach (OMLEngine.Title t in _titles) //{ // i++; // groupedGalleryListListViewItem2.Add(new Library.Code.V3.MovieItem(t, groupedGalleryListListViewItem2)); // if (i > 50) // break; //} //Library.Code.V3.BrowseGroup testGroup2 = new Library.Code.V3.BrowseGroup();//this, "Sample Group", groupedGalleryListListViewItem); //testGroup2.Owner = gallery; //testGroup2.Description = "Group 2"; //testGroup2.Metadata = "12 titles"; //testGroup2.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery"); //testGroup2.Content = groupedGalleryListListViewItem2; //testGroup2.ContentLabelTemplate = Library.Code.V3.BrowseGroup.StandardContentLabelTemplate; //groupListView.Add(testGroup2); //Library.Code.V3.BrowsePivot group1 = new Library.Code.V3.BrowsePivot(gallery, "group", "grouped...", groupListView); //group1.ContentLabel = galleryName; //group1.SupportsJIL = false; //group1.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; //group1.ContentItemTemplate = "GalleryGroup"; //group1.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate; //gallery.Model.Pivots.Options.Add(group1); //#endregion grouped ////Genres test //#region Genres //VirtualList galleryListthreeRowGalleryItemPoster = new VirtualList(gallery, null); //Library.Code.V3.GalleryItem actionAdventureGenre = new Library.Code.V3.GalleryItem(); //actionAdventureGenre.Description = "Action/Adventure"; //actionAdventureGenre.Metadata = "12 titles"; //actionAdventureGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_actionadventure"); //galleryListthreeRowGalleryItemPoster.Add(actionAdventureGenre); //Library.Code.V3.GalleryItem comedyGenre = new Library.Code.V3.GalleryItem(); //comedyGenre.Description = "Comedy"; //comedyGenre.Metadata = "12 titles"; //comedyGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_comedy"); //galleryListthreeRowGalleryItemPoster.Add(comedyGenre); //Library.Code.V3.GalleryItem documentaryGenre = new Library.Code.V3.GalleryItem(); //documentaryGenre.Description = "Documentary"; //documentaryGenre.Metadata = "12 titles"; //documentaryGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_documentary"); //galleryListthreeRowGalleryItemPoster.Add(documentaryGenre); //Library.Code.V3.GalleryItem dramaGenre = new Library.Code.V3.GalleryItem(); //dramaGenre.Description = "Drama"; //dramaGenre.Metadata = "12 titles"; //dramaGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_drama"); //galleryListthreeRowGalleryItemPoster.Add(dramaGenre); //Library.Code.V3.GalleryItem kidsFamilyGenre = new Library.Code.V3.GalleryItem(); //kidsFamilyGenre.Description = "Kids/Family"; //kidsFamilyGenre.Metadata = "12 titles"; //kidsFamilyGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_kidsfamily"); //galleryListthreeRowGalleryItemPoster.Add(kidsFamilyGenre); //Library.Code.V3.GalleryItem musicalGenre = new Library.Code.V3.GalleryItem(); //musicalGenre.Description = "Musical"; //musicalGenre.Metadata = "12 titles"; //musicalGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_musical"); //galleryListthreeRowGalleryItemPoster.Add(musicalGenre); //Library.Code.V3.GalleryItem mysteryGenre = new Library.Code.V3.GalleryItem(); //mysteryGenre.Description = "Mystery"; //mysteryGenre.Metadata = "12 titles"; //mysteryGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery"); //galleryListthreeRowGalleryItemPoster.Add(mysteryGenre); //Library.Code.V3.GalleryItem otherGenre = new Library.Code.V3.GalleryItem(); //otherGenre.Description = "Other"; //otherGenre.Metadata = "12 titles"; //otherGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_other"); //galleryListthreeRowGalleryItemPoster.Add(otherGenre); //Library.Code.V3.GalleryItem romanceGenre = new Library.Code.V3.GalleryItem(); //romanceGenre.Description = "Romance"; //romanceGenre.Metadata = "12 titles"; //romanceGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_romance"); //galleryListthreeRowGalleryItemPoster.Add(romanceGenre); //Library.Code.V3.GalleryItem scienceFictionGenre = new Library.Code.V3.GalleryItem(); //scienceFictionGenre.Description = "Science Fiction"; //scienceFictionGenre.Metadata = "12 titles"; //scienceFictionGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_sciencefiction"); //galleryListthreeRowGalleryItemPoster.Add(scienceFictionGenre); //Library.Code.V3.GalleryItem westernGenre = new Library.Code.V3.GalleryItem(); //westernGenre.Description = "Western"; //westernGenre.Metadata = "12 titles"; //westernGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_western"); //galleryListthreeRowGalleryItemPoster.Add(westernGenre); //Library.Code.V3.GalleryItem noimageGenre = new Library.Code.V3.GalleryItem(); //noimageGenre.Description = "No Image ergeg ergege egegeg"; //noimageGenre.Metadata = "12 titles"; //noimageGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_noimagegenre"); //galleryListthreeRowGalleryItemPoster.Add(noimageGenre); ////foreach (Title t in _titles) ////{ //// galleryListthreeRowGalleryItemPoster.Add(this.CreateGalleryItem(t)); ////} //Library.Code.V3.BrowsePivot p4 = new Library.Code.V3.BrowsePivot(gallery, "genres", "loading genres...", galleryListthreeRowGalleryItemPoster); //p4.ContentLabel = galleryName; //p4.SupportsJIL = true; //p4.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; //p4.ContentItemTemplate = "twoRowGalleryItemGenre"; //p4.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate; //gallery.Model.Pivots.Options.Add(p4); //#endregion Genres // add OML filters //System.Collections.Specialized.StringCollection filtersToShow = // Properties.Settings.Default.MainFiltersToShow; //foreach (string filterName in filtersToShow) //{ // OMLEngine.TitleFilterType filterType = Filter.FilterStringToTitleType(filterName); // Filter f = new Filter(null, filterType, null);//new MovieGallery() // if (Filter.ShowFilterType(filterType)) // { // ////IEnumerable<Title> titles = TitleCollectionManager.GetAllTitles(); // //IEnumerable<Title> titles; // //if (filterType == TitleFilterType.DateAdded || filterType == TitleFilterType.VideoFormat) // //{ // // titles = TitleCollectionManager.GetAllTitles(); // //} // //else // //{ // // titles = TitleCollectionManager.GetFilteredTitles(filterType, filterName); // //} // //VirtualList filteredGalleryList = new VirtualList(gallery, null); // //foreach (Title t in titles) // //{ // // //galleryList.Add(this.CreateGalleryItem(t)); // // filteredGalleryList.Add(new Library.Code.V3.MovieItem(t, filteredGalleryList)); // //} // VirtualList filteredGalleryList = new VirtualList(gallery, null); // System.Collections.Generic.IList<Library.GalleryItem> filteredTitles = f.GetGalleryItems(); // foreach (Library.GalleryItem item in filteredTitles) // { // filteredGalleryList.Add(new Library.Code.V3.MovieItem(item, filteredGalleryList)); // } // Library.Code.V3.BrowsePivot filteredPivot = new Library.Code.V3.BrowsePivot(gallery, Filter.FilterTypeToString(filterType).ToLower(), "loading titles...", filteredGalleryList); // filteredPivot.ContentLabel = "OML"; // filteredPivot.SupportsJIL = true; // filteredPivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; // filteredPivot.ContentItemTemplate = "ListViewItem"; // filteredPivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; // gallery.Model.Pivots.Options.Add(filteredPivot); // } //} //end add OML filters //properties.Add("Gallery", new GalleryV2(properties, _titles)); properties.Add("Page", gallery); Library.Code.V3.MovieDetailsSlideDeck deck = new Library.Code.V3.MovieDetailsSlideDeck(); //Choice c = new Choice(); VirtualList Options = new VirtualList(); Library.Code.V3.SlideBlueprint bp = new Library.Code.V3.SlideBlueprint(@"resx://Library/Library.Resources/V3_Slide_Movie_Details_Synopsis", "Synopsis", DateTime.MinValue, DateTime.Now); Library.Code.V3.SlideBlueprint bp2 = new Library.Code.V3.SlideBlueprint(@"resx://Library/Library.Resources/V3_Slide_Movie_Details_Actions", "Actions", DateTime.MinValue, DateTime.Now); Options.Add(bp); Options.Add(bp2); deck.Options = Options; deck.Commands = new ArrayListDataSet(); //dummy up some cmds Library.Code.V3.ThumbnailCommand deleteCmd = new Library.Code.V3.ThumbnailCommand(deck); deleteCmd.Description = "Delete"; deleteCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove"); deleteCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove_Dormant"); deleteCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove_Focus"); deck.Commands.Add(deleteCmd); Library.Code.V3.ThumbnailCommand playCmd = new Library.Code.V3.ThumbnailCommand(deck); playCmd.Description = "Play"; playCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play"); playCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play_Dormant"); playCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play_Focus"); deck.Commands.Add(playCmd); deck.Description = "descrip"; deck.Synopsis = "this is a syn adfge rh rhyr yhyr hr hr ge ge gtwt rgwe tgew gr ewg weg ewg wetg wrt g rhtytjuhytgfr er gtwrt her etju ktjy hgt efr erfgetw"; deck.AdditionalCommands = new ArrayListDataSet(); deck.CommandPopOverlay = new Command(); //deck.CommandPopOverlay.Invoked += new EventHandler(CommandPopOverlay_Invoked); deck.CommandClearOverlays = new Command(); //deck.CommandClearOverlays.Invoked += new EventHandler(CommandClearOverlays_Invoked); deck.CommandPushOverlay = new Command(); //deck.CommandPushOverlay.Invoked += new EventHandler(CommandPushOverlay_Invoked); //deck.AdditionalCommands.Add(cmd); properties.Add("SlideDeck", deck); properties.Add("CommandPopOverlay", deck.CommandPopOverlay); properties.Add("CommandClearOverlays", deck.CommandClearOverlays); properties.Add("CommandPushOverlay", deck.CommandPushOverlay); deck.Context = "hi"; //_session.GoToPage(@"resx://Library/Library.Resources/V3_SlideDeck_Movie_Details", properties); //gallery.Model.Pivots.Chosen = p2; //gallery.Model.Pivots.ChosenChanged += new EventHandler(Pivots_ChosenChanged); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); //_page = gallery; //_deck = deck; #endregion v3POC }
private void ParseDocument(XmlDocument xDoc) { //this.trailers = new List<TrailerItem>(); XPathNavigator nav = xDoc.CreateNavigator(); XPathExpression expr; expr = nav.Compile("//*/genre/name[not(.=preceding::*/genre/name)] "); XPathNodeIterator iterator = nav.Select(expr); // Iterate on the node set //genres = new List<TrailerGenreItem>(); while (iterator.MoveNext()) { XPathNavigator nav2 = iterator.Current.Clone(); Application.DeferredInvoke(delegate { TrailerGenreItem genre = new TrailerGenreItem(this); genre.Description = nav2.Value; genre.Invoked += delegate(object genreSender, EventArgs genreArgs) { OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); properties.Add("I18n", I18n.Instance); Library.Code.V3.TrailerPage gallery = new Library.Code.V3.TrailerPage("trailers", genre); Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); //add name piv List <TrailerItem> nameTrailers = this.SortTrailersByName(genre.Trailers) as List <TrailerItem>; VirtualList nameGalleryList = new VirtualList(gallery, null); foreach (TrailerItem t in nameTrailers) { nameGalleryList.Add(t); } Library.Code.V3.BrowsePivot namePivot = new Library.Code.V3.BrowsePivot(gallery, "title", "No titles were found.", nameGalleryList); namePivot.ContentLabel = genre.Description; namePivot.SetupContextMenu(); namePivot.SupportsJIL = true; namePivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; namePivot.ContentItemTemplate = "oneRowGalleryItemPoster"; namePivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; gallery.Model.Pivots.Options.Add(namePivot); gallery.Model.Pivots.Chosen = namePivot; List <TrailerItem> dateTrailers = this.SortTrailersByDate(genre.Trailers) as List <TrailerItem>; VirtualList dateGalleryList = new VirtualList(gallery, null); foreach (TrailerItem t in dateTrailers) { dateGalleryList.Add(t); } Library.Code.V3.BrowsePivot datePivot = new Library.Code.V3.BrowsePivot(gallery, "date added", "No titles were found.", dateGalleryList); datePivot.ContentLabel = genre.Description; datePivot.SetupContextMenu(); datePivot.SupportsJIL = true; datePivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery"; datePivot.ContentItemTemplate = "oneRowGalleryItemPoster"; datePivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate; gallery.Model.Pivots.Options.Add(datePivot); properties.Add("Page", gallery); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; genres.Add(genre); }); } if (nav.MoveToChild("records", "")) { XPathNodeIterator nIter = nav.SelectChildren("movieinfo", ""); nav.MoveToFirstChild(); XPathNavigator localNav = nav.CreateNavigator(); nav.MoveToParent(); for (int i = 0; i < nIter.Count; i++) { Application.DeferredInvoke(delegate { TrailerItem currentTrailer = new TrailerItem(this); if (localNav.MoveToChild("info", "")) { currentTrailer.Copyright = GetChildNodesValue(localNav, "copyright"); currentTrailer.Tagline = GetChildNodesValue(localNav, "description"); currentTrailer.Director = GetChildNodesValue(localNav, "director"); //currentTrailer.Postdate = GetChildNodesValue(localNav, "postdate"); currentTrailer.Rating = GetChildNodesValue(localNav, "rating"); //currentTrailer.ReleaseDate = GetChildNodesValue(localNav, "releasedate"); string postdate = GetChildNodesValue(localNav, "postdate"); if (!string.IsNullOrEmpty(postdate)) { try { currentTrailer.Postdate = Convert.ToDateTime(postdate); } catch { currentTrailer.Postdate = new DateTime(1900, 1, 1); } } string releaseDate = GetChildNodesValue(localNav, "releasedate"); if (!string.IsNullOrEmpty(releaseDate)) { try { currentTrailer.ReleaseDate = Convert.ToDateTime(releaseDate); currentTrailer.MetadataTop = string.Format("{0}, in theaters {1}", currentTrailer.Rating, currentTrailer.ReleaseDate.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))); } catch { currentTrailer.ReleaseDate = new DateTime(1900, 1, 1); } } currentTrailer.Runtime = GetChildNodesValue(localNav, "runtime"); currentTrailer.Studio = GetChildNodesValue(localNav, "studio"); currentTrailer.Metadata = currentTrailer.Studio; currentTrailer.Description = GetChildNodesValue(localNav, "title"); localNav.MoveToParent(); } if (localNav.MoveToChild("cast", "")) { XPathNodeIterator castIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator castNav = localNav.CreateNavigator(); for (int j = 0; j < castIter.Count; j++) { currentTrailer.Actors.Add(castNav.Value); castNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("genre", "")) { XPathNodeIterator genreIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator genreNav = localNav.CreateNavigator(); for (int k = 0; k < genreIter.Count; k++) { currentTrailer.Genres.Add(genreNav.Value); genreNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("poster", "")) { if (localNav.MoveToChild("location", "")) { currentTrailer.PosterUrl = localNav.Value; localNav.MoveToParent(); } if (localNav.MoveToChild("xlarge", "")) { currentTrailer.XLargePosterUrl = localNav.Value; localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("preview", "")) { if (localNav.MoveToChild(XPathNodeType.Element)) { currentTrailer.TrailerUrl = localNav.Value; currentTrailer.Filesize = localNav.GetAttribute("filesize", ""); localNav.MoveToParent(); } localNav.MoveToParent(); } trailers.Add(currentTrailer); //this could probably be done better foreach (string strGenre in currentTrailer.Genres) { foreach (TrailerGenreItem genre in this.genres) { if (strGenre == genre.Description) { genre.Trailers.Add(currentTrailer); break; } } } localNav.MoveToNext(); }); } } //return trailers; }