示例#1
0
        private void PublishCrewSkinProperties(TraktPersonShowJob creditItem)
        {
            GUICommon.SetProperty("#Trakt.Person.Show.CreditValue", GUICommon.GetTranslatedCreditJob(creditItem.Job));
            GUICommon.SetProperty("#Trakt.Person.Show.CreditType", Translation.Job);

            GUICommon.SetShowProperties(creditItem.Show);
        }
        private void PublishCrewSkinProperties(TraktPersonMovieJob creditItem)
        {
            GUICommon.SetProperty("#Trakt.Person.Movie.CreditValue", GUICommon.GetTranslatedCreditJob(creditItem.Job));
            GUICommon.SetProperty("#Trakt.Person.Movie.CreditType", Translation.Job);

            GUICommon.SetMovieProperties(creditItem.Movie);
        }
示例#3
0
        private void OnCrewSelected(GUIListItem item, GUIControl parent)
        {
            PreviousSelectedIndex = Facade.SelectedListItemIndex;

            var selectedItem = item as GUIPersonListItem;

            if (item == null)
            {
                return;
            }

            GUIUtils.SetProperty("#Trakt.Person.CreditType", Translation.Job);
            GUIUtils.SetProperty("#Trakt.Person.CreditValue", GUICommon.GetTranslatedCreditJob(selectedItem.Job.Job));
            GUICommon.SetPersonProperties(selectedItem.Person);
        }
示例#4
0
        private void SendCreditResultsToFacade(TraktCredits credits)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (credits == null)
            {
                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral);
                GUIWindowManager.ShowPreviousWindow();
                Show = null;
                return;
            }

            int itemId       = 0;
            var personImages = new List <GUITmdbImage>();

            // Add each character
            if (Type == CreditType.Cast && credits.Cast != null)
            {
                foreach (var person in credits.Cast)
                {
                    // add image for download
                    var images = new GUITmdbImage {
                        PeopleImages = new TmdbPeopleImages {
                            Id = person.Person.Ids.TmdbId
                        }
                    };
                    personImages.Add(images);

                    var item = new GUIPersonListItem(string.IsNullOrEmpty(person.Character) ? person.Person.Name : string.Format(Translation.ActorAndRole, person.Person.Name, person.Character), (int)TraktGUIWindows.CreditsShow);

                    item.Person          = person.Person;
                    item.CreditType      = Credit.Cast;
                    item.Character       = person;
                    item.Images          = images;
                    item.ItemId          = Int32.MaxValue - itemId;
                    item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                    item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                    item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                    item.OnItemSelected += OnCastSelected;
                    Utils.SetDefaultIcons(item);
                    Facade.Add(item);
                    itemId++;
                }
            }

            // add each crew member
            if (Type == CreditType.Crew && credits.Crew != null)
            {
                if (credits.Crew.Directing != null)
                {
                    foreach (var person in credits.Crew.Directing)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Directing;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.Writing != null)
                {
                    foreach (var person in credits.Crew.Writing)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Writing;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.Production != null)
                {
                    foreach (var person in credits.Crew.Production)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Production;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.Art != null)
                {
                    foreach (var person in credits.Crew.Art)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Art;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.Camera != null)
                {
                    foreach (var person in credits.Crew.Camera)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Camera;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.CostumeAndMakeUp != null)
                {
                    foreach (var person in credits.Crew.CostumeAndMakeUp)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.CostumeAndMakeUp;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }

                if (credits.Crew.Sound != null)
                {
                    foreach (var person in credits.Crew.Sound)
                    {
                        // add image for download
                        var images = new GUITmdbImage {
                            PeopleImages = new TmdbPeopleImages {
                                Id = person.Person.Ids.TmdbId
                            }
                        };
                        personImages.Add(images);

                        var item = new GUIPersonListItem(person.Person.Name, (int)TraktGUIWindows.CreditsShow);
                        item.Label2          = GUICommon.GetTranslatedCreditJob(person.Job);
                        item.Person          = person.Person;
                        item.CreditType      = Credit.Sound;
                        item.Job             = person;
                        item.Images          = images;
                        item.ItemId          = Int32.MaxValue - itemId;
                        item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                        item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                        item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                        item.OnItemSelected += OnCrewSelected;
                        Utils.SetDefaultIcons(item);
                        Facade.Add(item);
                        itemId++;
                    }
                }
            }

            // if nothing to display exit
            if (Facade.Count == 0)
            {
                GUIUtils.ShowNotifyDialog(Type == CreditType.Crew ? Translation.Crew : Translation.Cast, Translation.NoCreditsFound);
                GUIWindowManager.ShowPreviousWindow();
                Show = null;
                return;
            }

            // Set Facade Layout
            Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout));
            GUIControl.FocusControl(GetID, Facade.GetID);

            Facade.SelectIndex(PreviousSelectedIndex);

            // set facade properties
            GUIUtils.SetProperty("#itemcount", Facade.Count.ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", Facade.Count.ToString(), Facade.Count > 1 ? Translation.People : Translation.Person));

            // Download images Async and set to facade
            GUIPersonListItem.GetImages(personImages, false);
        }