public CollectionItem(Title title, IModelItem owner)
            : base(owner)
        {
            this._titleObj = title;
            //this.InternalMovieItem = new Library.MovieItem(title, null);

            this.ItemType = 0;
            if(OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon)
                this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay";
            if (this._titleObj.WatchedCount == 0)
                this.isUnwatched = true;

            DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1);
            //invalid dates
            if (releaseDate.Year != 1 && releaseDate.Year != 1900)
                this.MetadataTop = releaseDate.Year.ToString();
            else
                this.MetadataTop = "";

            this.ItemId = 1;
            string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero));
            this.StarRating = starRating;
            string extendedMetadata = string.Empty;

            this.SortName = title.SortName;

            //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17");
            this.Metadata = _titleObj.ParentalRating;
            if (string.IsNullOrEmpty(_titleObj.ParentalRating))
                this.Metadata = "Not Rated";
            if (_titleObj.Runtime.ToString() != "0")
                this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString());
            this.Tagline = _titleObj.Synopsis;

            this.Description = title.Name;

            //TODO: not sure how to read this yet...
            //temporarially disabled due to bug in eagerloading
            //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString();

            this.Invoked += delegate(object sender, EventArgs args)
            {
                //stub details for CollectionItem
                CollectionPage page = new CollectionPage(this);
                OMLProperties properties = new OMLProperties();
                properties.Add("Application", OMLApplication.Current);
                //properties.Add("UISettings", new UISettings());
                //properties.Add("Settings", new Settings());
                properties.Add("I18n", I18n.Instance);
                //v3 main gallery
                //Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(new List<OMLEngine.TitleFilter>(), "OML");
                ////description
                //gallery.Description = "OML";
                Command CommandContextPopOverlay = new Command();
                properties.Add("CommandContextPopOverlay", CommandContextPopOverlay);
                properties.Add("Page", page);
                OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties);
            };
        }
Example #2
0
        private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
        {
            object commandForItem = null;

            if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
            {
                commandForItem = this.m_listContent[idx];
            }
            else if (((this.titles != null) && (idx >= 0)) && (idx < this.titles.Count))
            {
                OMLEngine.Title item = this.titles[idx] as OMLEngine.Title;
                if (item != null)
                {
                    commandForItem = this.GetCommandForItem(item);
                }
            }
            callbackItem(vlist, idx, commandForItem);
        }
Example #3
0
        public void DeleteTitle(OMLEngine.Title item)
        {
            foreach (Disk d in item.Disks)
            {
                string status = deleteDisk(d);
                if (!string.IsNullOrEmpty(status))
                {
                    this.MediaCenterEnvironment.Dialog(
                        string.Format("Unable to delete this movie: {0}", status),
                        "Failed", DialogButtons.Ok, 5, false);
                    return;
                }
                else
                {
                    TitleCollectionManager.DeleteTitle(item);
                }
            }
            TitleEventArgs t = new TitleEventArgs(item);

            this.OnTitleDeleted(t);
        }
Example #4
0
        public MovieItem(Title title, IModelItem owner)
            : base(owner)
        {
            this._titleObj = title;
            this.setCoverArtThemeId(title.Name);
            //this.InternalMovieItem = new Library.MovieItem(title, null);

            this.ItemType = 0;
            if (OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon)
            {
                this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay";
            }
            if (this._titleObj.WatchedCount == 0)
            {
                this.isUnwatched = true;
            }

            DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1);

            //invalid dates
            if (releaseDate.Year != 1 && releaseDate.Year != 1900)
            {
                this.MetadataTop = releaseDate.Year.ToString();
            }
            else
            {
                this.MetadataTop = "";
            }

            this.ItemId = 1;
            string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero));

            this.StarRating = starRating;
            string extendedMetadata = string.Empty;

            this.SortName = title.SortName;

            //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17");
            this.Metadata = _titleObj.ParentalRating;
            if (string.IsNullOrEmpty(_titleObj.ParentalRating))
            {
                this.Metadata = "Not Rated";
            }
            if (_titleObj.Runtime.ToString() != "0")
            {
                this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString());
            }
            this.Tagline = _titleObj.Synopsis;

            this.Description = title.Name;

            //TODO: not sure how to read this yet...
            //temporarially disabled due to bug in eagerloading
            //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString();


            this.Invoked += delegate(object sender, EventArgs args)
            {
                //to test v3
                Library.Code.V3.DetailsPage page = new Library.Code.V3.DetailsPage();

                page.Description = "movie details";
                page.Title       = this.Description;
                page.Summary     = _titleObj.Synopsis;
                page.Background  = this.DefaultImage;

                page.Details = new Library.Code.V3.ExtendedDetails();

                page.Details.CastArray = new ArrayListDataSet();

                string directors     = string.Empty;
                int    directorCount = 0;
                foreach (Person director in _titleObj.Directors)
                {
                    Library.Code.V3.CastCommand directorCommand = new Library.Code.V3.CastCommand();
                    directorCommand.Role        = " ";
                    directorCommand.Description = director.full_name;
                    directorCommand.Invoked    += new EventHandler(actorCommand_Invoked);
                    if (directorCount == 0)
                    {
                        directorCommand.CastType   = "TitleAndDesc";
                        directorCommand.GroupTitle = "DIRECTOR";
                        directorCommand.ActorId    = 1;//not sure how this works in oml
                    }
                    else
                    {
                        directorCommand.CastType = "Desc";
                    }
                    page.Details.CastArray.Add(directorCommand);
                    directorCount++;
                    AppendSeparatedValue(ref directors, director.full_name, "; ");
                }
                if (!string.IsNullOrEmpty(directors))
                {
                    page.Details.Director = string.Format("Directed By: {0}", directors);
                }

                string cast       = string.Empty;
                int    actorCount = 0;
                foreach (Role kvp in _titleObj.ActingRoles)
                {
                    Library.Code.V3.CastCommand actorCommand = new Library.Code.V3.CastCommand();
                    actorCommand.Description = kvp.PersonName;
                    actorCommand.ActorId     = 1;//not sure how this works in oml
                    actorCommand.Invoked    += new EventHandler(actorCommand_Invoked);
                    actorCommand.Role        = kvp.RoleName;
                    if (actorCount == 0)
                    {
                        //add the title "CAST"
                        actorCommand.CastType   = "TitleAndDesc";
                        actorCommand.GroupTitle = "CAST";
                    }
                    else
                    {
                        actorCommand.CastType = "Desc";
                    }

                    page.Details.CastArray.Add(actorCommand);
                    actorCount++;
                    AppendSeparatedValue(ref cast, kvp.PersonName, "; ");
                }

                //foreach (string castmember in this.InternalMovieItem.Actors)
                //{
                //    AppendSeparatedValue(ref cast, castmember, "; ");
                //}
                if (!string.IsNullOrEmpty(cast))
                {
                    page.Details.Cast = string.Format("Cast Info: {0}", cast);
                }


                if (this.StarRating != "0")
                {
                    page.Details.StarRating = new Image(string.Format("resx://Library/Library.Resources/V3_Controls_Common_Stars_{0}", starRating));
                }

                //strip invalid dates
                if (releaseDate.Year != 1 && releaseDate.Year != 1900)
                {
                    page.Details.YearString = releaseDate.Year.ToString();
                }

                page.Details.Studio = _titleObj.Studio;

                string genres = string.Empty;
                if (_titleObj.Genres.Count > 0)
                {
                    foreach (string genre in _titleObj.Genres)
                    {
                        AppendSeparatedValue(ref genres, genre, ", ");
                    }
                }
                AppendSeparatedValue(ref genres, this.Metadata, ", ");
                page.Details.GenreRatingandRuntime = genres;

                //fixes double spacing issues
                page.Details.Summary = _titleObj.Synopsis.Replace("\r\n", "\n");
                page.Commands        = new ArrayListDataSet(page);
                //default play command
                Command playCmd = new Command();
                playCmd.Description = "Play";
                playCmd.Invoked    += new EventHandler(playCmd_Invoked);
                page.Commands.Add(playCmd);

                if (page.Details.CastArray.Count > 0)
                {
                    Command command = new Command();
                    command.Description = "Cast + More";

                    command.Invoked += delegate(object castSender, EventArgs castArgs)
                    {
                        Dictionary <string, object> castProperties = new Dictionary <string, object>();
                        castProperties["Page"]        = page;
                        castProperties["Application"] = Library.OMLApplication.Current;
                        Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPageCastCrew", castProperties);
                    };

                    page.Commands.Add(command);
                }

                if (Properties.Settings.Default.AllowDelete)
                {
                    //delete a title
                    Command deleteCmd = new Command();
                    deleteCmd.Description = "Delete";
                    deleteCmd.Invoked    += new EventHandler(deleteCmd_Invoked);
                    page.Commands.Add(deleteCmd);
                }

                page.Watched = new BooleanChoice(this, "Watched");

                //is this the right way?
                // yes :)
                if (_titleObj.WatchedCount > 0)
                {
                    page.Watched.Value = true;
                }
                else
                {
                    page.Watched.Value = false;
                }

                page.Watched.ChosenChanged += new EventHandler(Watched_ChosenChanged);

                this.SetFanArtImage(page.Details, _titleObj);

                Dictionary <string, object> properties = new Dictionary <string, object>();
                properties["Page"]        = page;
                properties["Application"] = Library.OMLApplication.Current;

                if (page.Details.FanArt != null)
                {
                    Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_FanArtDetailsPage", properties);
                }
                else
                {
                    Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPage", properties);
                }
            };
        }
Example #5
0
 private object GetCommandForItem(OMLEngine.Title item)
 {
     this.pulleditemCount++;
     Console.WriteLine(this.pulleditemCount.ToString());
     return(new Library.Code.V3.MovieItem(item, this));
 }
Example #6
0
        public void WatchTitle(OMLEngine.Title item)
        {
            TitleEventArgs t = new TitleEventArgs(item);

            this.OnTitleWatched(t);
        }
Example #7
0
 public TitleEventArgs(OMLEngine.Title title)
 {
     this.Title = title;
 }
Example #8
0
        public EpisodeItem(Title title, IModelItem owner)
            : base(owner)
        {
            this._titleObj = title;
            //this.InternalMovieItem = new Library.MovieItem(title, null);

            this.ItemType = 0;
            if(OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon)
                this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay";
            if (this._titleObj.WatchedCount == 0)
                this.isUnwatched = true;

            DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1);
            //invalid dates
            if (releaseDate.Year != 1 && releaseDate.Year != 1900)
                this.MetadataTop = releaseDate.Year.ToString();
            else
                this.MetadataTop = "";

            this.ItemId = 1;
            string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero));
            this.StarRating = starRating;
            string extendedMetadata = string.Empty;

            this.SortName = title.SortName;

            //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17");
            this.Metadata = _titleObj.ParentalRating;
            if (string.IsNullOrEmpty(_titleObj.ParentalRating))
                this.Metadata = "Not Rated";
            if (_titleObj.Runtime.ToString() != "0")
                this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString());
            this.Tagline = _titleObj.Synopsis;

            this.Description = title.Name;

            //TODO: not sure how to read this yet...
            //temporarially disabled due to bug in eagerloading
            //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString();

            this.Invoked += delegate(object sender, EventArgs args)
            {

                //to test v3
                Library.Code.V3.DetailsPage page = new Library.Code.V3.DetailsPage();

                page.Description = "episode details";
                page.Title = this.Description;
                page.Summary = _titleObj.Synopsis;
                page.Background = this.DefaultImage;

                page.Details = new Library.Code.V3.ExtendedDetails();

                page.Details.CastArray = new ArrayListDataSet();

                string directors = string.Empty;
                int directorCount = 0;
                foreach (Person director in _titleObj.Directors)
                {
                    Library.Code.V3.CastCommand directorCommand = new Library.Code.V3.CastCommand();
                    directorCommand.Role = " ";
                    directorCommand.Description = director.full_name;
                    directorCommand.Invoked += new EventHandler(actorCommand_Invoked);
                    if (directorCount == 0)
                    {
                        directorCommand.CastType = "TitleAndDesc";
                        directorCommand.GroupTitle = "DIRECTOR";
                        directorCommand.ActorId = 1;//not sure how this works in oml
                    }
                    else
                        directorCommand.CastType = "Desc";
                    page.Details.CastArray.Add(directorCommand);
                    directorCount++;
                    AppendSeparatedValue(ref directors, director.full_name, "; ");
                }
                if (!string.IsNullOrEmpty(directors))
                    page.Details.Director = string.Format("Directed By: {0}", directors);

                string cast = string.Empty;
                int actorCount = 0;
                foreach (Role kvp in _titleObj.ActingRoles)
                {
                    Library.Code.V3.CastCommand actorCommand = new Library.Code.V3.CastCommand();
                    actorCommand.Description = kvp.PersonName;
                    actorCommand.ActorId = 1;//not sure how this works in oml
                    actorCommand.Invoked += new EventHandler(actorCommand_Invoked);
                    actorCommand.Role = kvp.RoleName;
                    if (actorCount == 0)
                    {
                        //add the title "CAST"
                        actorCommand.CastType = "TitleAndDesc";
                        actorCommand.GroupTitle = "CAST";
                    }
                    else
                        actorCommand.CastType = "Desc";

                    page.Details.CastArray.Add(actorCommand);
                    actorCount++;
                    AppendSeparatedValue(ref cast, kvp.PersonName, "; ");
                }

                //foreach (string castmember in this.InternalMovieItem.Actors)
                //{
                //    AppendSeparatedValue(ref cast, castmember, "; ");
                //}
                if (!string.IsNullOrEmpty(cast))
                    page.Details.Cast = string.Format("Cast Info: {0}", cast);

                if (this.StarRating != "0")
                    page.Details.StarRating = new Image(string.Format("resx://Library/Library.Resources/V3_Controls_Common_Stars_{0}", starRating));

                //strip invalid dates
                if (releaseDate.Year != 1 && releaseDate.Year != 1900)
                    page.Details.YearString = releaseDate.Year.ToString();

                page.Details.Studio = _titleObj.Studio;

                string genres = string.Empty;
                if (_titleObj.Genres.Count > 0)
                {
                    foreach (string genre in _titleObj.Genres)
                    {
                        AppendSeparatedValue(ref genres, genre, ", ");
                    }
                }
                AppendSeparatedValue(ref genres, this.Metadata, ", ");
                page.Details.GenreRatingandRuntime = genres;

                //fixes double spacing issues
                page.Details.Summary = _titleObj.Synopsis.Replace("\r\n", "\n");
                page.Commands = new ArrayListDataSet(page);
                //default play command
                Command playCmd = new Command();
                playCmd.Description = "Play";
                playCmd.Invoked += new EventHandler(playCmd_Invoked);
                page.Commands.Add(playCmd);

                if (page.Details.CastArray.Count > 0)
                {
                    Command command = new Command();
                    command.Description = "Cast + More";

                    command.Invoked += delegate(object castSender, EventArgs castArgs)
                    {
                        Dictionary<string, object> castProperties = new Dictionary<string, object>();
                        castProperties["Page"] = page;
                        castProperties["Application"] = Library.OMLApplication.Current;
                        Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_DetailsPageCastCrew", castProperties);
                    };

                    page.Commands.Add(command);
                }

                page.Watched = new BooleanChoice(this, "Watched");

                //is this the right way?
                // yes :)
                if (_titleObj.WatchedCount > 0)
                    page.Watched.Value = true;
                else
                    page.Watched.Value = false;

                page.Watched.ChosenChanged += new EventHandler(Watched_ChosenChanged);

                this.SetFanArtImage(page.Details, _titleObj);

                Dictionary<string, object> properties = new Dictionary<string, object>();
                properties["Page"] = page;
                properties["Application"] = Library.OMLApplication.Current;

                if (page.Details.FanArt!=null)
                    Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_FanArtDetailsPage", properties);
                else
                    Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_EpisodeDetailsPage", properties);
            };
        }
Example #9
0
        public SeasonItem(Title title, IModelItem owner)
            : base(owner)
        {
            this._titleObj = title;
            //this.InternalMovieItem = new Library.MovieItem(title, null);

            this.ItemType = 0;
            if (OMLEngine.Settings.OMLSettings.ShowUnwatchedIcon)
            {
                this.OverlayContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGalleryItem#UnwatchedOverlay";
            }
            if (this._titleObj.WatchedCount == 0)
            {
                this.isUnwatched = true;
            }

            DateTime releaseDate = Convert.ToDateTime(_titleObj.ReleaseDate.ToString("MMMM dd, yyyy"));// new DateTime(2000, 1, 1);

            //invalid dates
            if (releaseDate.Year != 1 && releaseDate.Year != 1900)
            {
                this.MetadataTop = releaseDate.Year.ToString();
            }
            else
            {
                this.MetadataTop = "";
            }

            this.ItemId = 1;
            string starRating = Convert.ToString(Math.Round((Convert.ToDouble(_titleObj.UserStarRating.HasValue ? _titleObj.UserStarRating.Value : 0) * 0.8), MidpointRounding.AwayFromZero));

            this.StarRating = starRating;
            string extendedMetadata = string.Empty;

            this.SortName = title.SortName;

            //this.Metadata = this.InternalMovieItem.Rating.Replace("PG13", "PG-13").Replace("NC17", "NC-17");
            this.Metadata = _titleObj.ParentalRating;
            if (string.IsNullOrEmpty(_titleObj.ParentalRating))
            {
                this.Metadata = "Not Rated";
            }
            if (_titleObj.Runtime.ToString() != "0")
            {
                this.Metadata += string.Format(", {0} minutes", _titleObj.Runtime.ToString());
            }
            this.Tagline = _titleObj.Synopsis;

            this.Description = title.Name;

            //TODO: not sure how to read this yet...
            //temporarially disabled due to bug in eagerloading
            //this.SimpleVideoFormat = _titleObj.VideoFormat.ToString();


            this.Invoked += delegate(object sender, EventArgs args)
            {
                //stub details for CollectionItem
                SeasonPage    page       = new SeasonPage(this);
                OMLProperties properties = new OMLProperties();
                properties.Add("Application", OMLApplication.Current);
                //properties.Add("UISettings", new UISettings());
                //properties.Add("Settings", new Settings());
                properties.Add("I18n", I18n.Instance);
                //v3 main gallery
                //Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(new List<OMLEngine.TitleFilter>(), "OML");
                ////description
                //gallery.Description = "OML";
                Command CommandContextPopOverlay = new Command();
                properties.Add("CommandContextPopOverlay", CommandContextPopOverlay);
                properties.Add("Page", page);
                OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties);
            };
        }