Ejemplo n.º 1
0
        private void LoadFacade(List <DBActor> actors)
        {
            // clear facade
            GUIControl.ClearControl(GetID, FacadeActors.GetID);

            // set number of actors property
            GUIPropertyManager.SetProperty("#itemcount", actors.Count().ToString());

            // notify user if no actors to display and backout of window
            if (actors.Count == 0)
            {
                SetProperty("NoActors", Translation.NoActors);
                TVSeriesPlugin.ShowNotifyDialog(Translation.Actors, Translation.NoActors);
                GUIWindowManager.ShowPreviousWindow();
            }

            // Add each actor to the list
            foreach (var actor in actors)
            {
                GUIActorListItem actorItem = new GUIActorListItem(actor.ToString());

                actorItem.Item            = actor;
                actorItem.IconImage       = "defaultActor.png";
                actorItem.IconImageBig    = "defaultActor.png";
                actorItem.ThumbnailImage  = "defaultActor.png";
                actorItem.OnItemSelected += OnActorSelected;
                Utils.SetDefaultIcons(actorItem);
                FacadeActors.Add(actorItem);
            }

            FacadeActors.SelectedListItemIndex = 0;

            // Download actor images async and set to facade
            GetImages(actors);

            // Set Facade Layout
            FacadeActors.CurrentLayout = (GUIFacadeControl.Layout)CurrentLayout;
            GUIControl.FocusControl(GetID, FacadeActors.GetID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Notify user in GUI if an error state was returned from Trakt API
        /// </summary>
        public static void CheckTraktErrorAndNotify <T>(T response, bool notify)
        {
            var r = response as TraktResponse;

            if (r == null || r.Status == null)
            {
                return;
            }

            // check response error status
            if (r.Status != "success")
            {
                MPTVSeriesLog.Write("Trakt Error: {0}", r.Error);
                if (notify)
                {
                    TVSeriesPlugin.ShowNotifyDialog(Translation.TraktError, r.Error);
                }
            }
            else
            {
                // success
                MPTVSeriesLog.Write("Trakt Response: {0}", r.Message);
            }
        }