Beispiel #1
0
        protected override void OnShowContextMenu()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(498);         // menu
            dlg.AddLocalizedString(970); //prev screen
            dlg.Add("Fullscreen");
            dlg.DoModal(GetID);
            if (dlg.SelectedId == -1)
            {
                return;
            }
            switch (dlg.SelectedLabel)
            {
            case 0:
                GUIWindowManager.ShowPreviousWindow();
                break;

            case 1:
                g_Player.ShowFullScreenWindow();
                break;
            }
        }
Beispiel #2
0
        private void SendSearchResultsToFacade(IEnumerable <TraktEpisodeSummary> episodes)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (episodes == null || episodes.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound);
                GUIWindowManager.ShowPreviousWindow();
                Episodes = null;
                return;
            }

            int itemId     = 0;
            var showImages = new List <TraktImage>();

            // Add each show
            foreach (var episodeSummary in episodes)
            {
                // add images for download
                var images = new TraktImage
                {
                    EpisodeImages = episodeSummary.Episode.Images,
                    ShowImages    = episodeSummary.Show.Images
                };
                showImages.Add(images);

                var item = new GUIEpisodeListItem(episodeSummary.ToString(), (int)TraktGUIWindows.SearchEpisodes);

                item.Label2          = episodeSummary.Show.Year.ToString();
                item.TVTag           = episodeSummary;
                item.Images          = images;
                item.IsPlayed        = episodeSummary.Episode.Watched;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = "defaultTraktEpisode.png";
                item.IconImageBig    = "defaultTraktEpisodeBig.png";
                item.ThumbnailImage  = "defaultTraktEpisodeBig.png";
                item.OnItemSelected += OnEpisodeSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            if (SearchTermChanged)
            {
                PreviousSelectedIndex = 0;
            }
            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download images Async and set to facade
            GUIEpisodeListItem.GetImages(showImages);
        }
Beispiel #3
0
        private void SendCastToFacade(List <TraktPersonShowCast> cast)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

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

            // filter Shows
            var filteredCast = FilterCastShows(cast).Where(m => !string.IsNullOrEmpty(m.Show.Title)).ToList();

            // sort Shows
            filteredCast.Sort(new GUIListItemShowSorter(TraktSettings.SortByCreditShows.Field, TraktSettings.SortByCreditShows.Direction));

            int             itemId     = 0;
            GUIShowListItem item       = null;
            var             ShowImages = new List <GUITmdbImage>();

            foreach (var credit in filteredCast)
            {
                // add image for download
                var images = new GUITmdbImage {
                    ShowImages = new TmdbShowImages {
                        Id = credit.Show.Ids.Tmdb
                    }
                };
                ShowImages.Add(images);

                item                 = new GUIShowListItem(credit.Show.Title, (int)TraktGUIWindows.PersonCreditShows);
                item.Label2          = credit.Show.Year == null ? "----" : credit.Show.Year.ToString();
                item.Show            = credit.Show;
                item.TVTag           = credit;
                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++;
            }

            // Set Facade Layout
            Facade.CurrentLayout = 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}", filteredCast.Count, filteredCast.Count > 1 ? Translation.Shows : Translation.Show));

            // Download Show images Async and set to facade
            GUIShowListItem.GetImages(ShowImages);
        }
Beispiel #4
0
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_STOP)
     {
         GUIWindowManager.ShowPreviousWindow();
     }
     base.OnAction(action);
 }
Beispiel #5
0
        private void SendShowSeasonsToFacade(IEnumerable <TraktShowSeason> seasons)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (seasons == null || seasons.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSeasonsForShow);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            // sort ascending or descending order
            if (TraktSettings.SortSeasonsAscending)
            {
                seasons = seasons.OrderBy(s => s.Season);
            }

            int itemId       = 0;
            var seasonImages = new List <TraktImage>();

            foreach (var season in seasons)
            {
                // add image for download
                var images = new TraktImage {
                    SeasonImages = season.Images, ShowImages = Show.Images
                };
                seasonImages.Add(images);

                string itemLabel = season.Season == 0 ? Translation.Specials : string.Format("{0} {1}", Translation.Season, season.Season.ToString());
                var    item      = new GUISeasonListItem(itemLabel, (int)TraktGUIWindows.ShowSeasons);

                item.Label2          = string.Format("{0} {1}", season.EpisodeCount, Translation.Episodes);
                item.TVTag           = season;
                item.Images          = images;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnSeasonSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download show images Async and set to facade
            GUISeasonListItem.GetImages(seasonImages);
        }
Beispiel #6
0
        private void SendTrendingShowsToFacade(IEnumerable <TraktTrendingShow> shows)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (shows.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoTrendingShows);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            // filter shows
            shows = GUICommon.FilterTrendingShows(shows);

            // sort shows
            var showList = shows.ToList();

            showList.Sort(new GUIListItemShowSorter(TraktSettings.SortByTrendingShows.Field, TraktSettings.SortByTrendingShows.Direction));

            int itemId = 0;
            List <TraktShow.ShowImages> showImages = new List <TraktShow.ShowImages>();

            foreach (var show in showList)
            {
                GUITraktTrendingShowListItem item = new GUITraktTrendingShowListItem(show.Title);

                item.Label2          = show.Year.ToString();
                item.TVTag           = show;
                item.Item            = show.Images;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = "defaultVideo.png";
                item.IconImageBig    = "defaultVideoBig.png";
                item.ThumbnailImage  = "defaultVideoBig.png";
                item.OnItemSelected += OnShowSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;

                // add image for download
                showImages.Add(show.Images);
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

            // set facade properties
            GUIUtils.SetProperty("#itemcount", shows.Count().ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", shows.Count().ToString(), shows.Count() > 1 ? Translation.SeriesPlural : Translation.Series));
            GUIUtils.SetProperty("#Trakt.Trending.PeopleCount", shows.Sum(s => s.Watchers).ToString());
            GUIUtils.SetProperty("#Trakt.Trending.Description", string.Format(Translation.TrendingTVShowsPeople, shows.Sum(s => s.Watchers).ToString(), shows.Count().ToString()));

            // Download show images Async and set to facade
            GetImages(showImages);
        }
        private void SendRelatedMoviesToFacade(IEnumerable <TraktMovie> movies)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (movies.Count() == 0)
            {
                string title = string.IsNullOrEmpty(relatedMovie.Title) ? relatedMovie.IMDbId : relatedMovie.Title;
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoRelatedMovies, title));
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            int itemId      = 0;
            var movieImages = new List <TraktImage>();

            // Add each movie
            foreach (var movie in movies.Where(m => !string.IsNullOrEmpty(m.Title)))
            {
                var item = new GUIMovieListItem(movie.Title, (int)TraktGUIWindows.RelatedMovies);

                // add image for download
                var image = new TraktImage {
                    MovieImages = movie.Images
                };
                movieImages.Add(image);

                item.Label2   = movie.Year;
                item.TVTag    = movie;
                item.Images   = image;
                item.IsPlayed = movie.Watched;
                item.ItemId   = Int32.MaxValue - itemId;
                // movie in collection doesnt nessararily mean
                // that the movie is locally available on this computer
                // as 'keep library clean' might not be enabled
                //item.IsRemote = !movie.InCollection;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnMovieSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download movie images Async and set to facade
            GUIMovieListItem.GetImages(movieImages);
        }
        private void SendSearchResultsToFacade(IEnumerable <TraktMovie> movies)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (movies == null || movies.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound);
                GUIWindowManager.ShowPreviousWindow();
                Movies = null;
                return;
            }

            int itemId      = 0;
            var movieImages = new List <TraktImage>();

            // Add each movie
            foreach (var movie in movies)
            {
                // add image for download
                var images = new TraktImage {
                    MovieImages = movie.Images
                };
                movieImages.Add(images);

                GUIMovieListItem item = new GUIMovieListItem(movie.Title, (int)TraktGUIWindows.SearchMovies);

                item.Label2          = movie.Year == "0" ? "----" : movie.Year;
                item.TVTag           = movie;
                item.Images          = images;
                item.IsPlayed        = movie.Watched;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnMovieSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            if (SearchTermChanged)
            {
                PreviousSelectedIndex = 0;
            }
            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download movie images Async and set to facade
            GUIMovieListItem.GetImages(movieImages);
        }
Beispiel #9
0
        public void LoginAndPlay()
        {
            if (!initialized)
            {
                return;
            }

            Thread work = new Thread(new ThreadStart(delegate
            {
                try
                {
                    // if needed, attempt to log in
                    if (Core.MusicBox.User == null)
                    {
                        setWorkingAnimationStatus(true);

                        logger.Info("Attempting to log in: " + Core.Settings.UserName);
                        Core.MusicBox.Login(Core.Settings.UserName, Core.Settings.Password);

                        // if login failed, log the message, notify the user, and exit
                        if (Core.MusicBox.User == null)
                        {
                            logger.Error("Invalid username or password.");

                            GUIWindowManager.ShowPreviousWindow();
                            DeInit();

                            ShowMessage("Pandora",
                                        "Invalid username or password. Please",
                                        "first login and verify your account",
                                        "via the configuration screen.",
                                        null);

                            return;
                        }

                        // if a previous station is stored in our settings, attempt to load it
                        if (Core.Settings.LastStation != null)
                        {
                            Core.MusicBox.CurrentStation = Core.Settings.LastStation;
                        }
                    }

                    // if nothing else is playing, play next track in our queue
                    if (!g_Player.Playing)
                    {
                        PlayNextTrack();
                    }

                    setWorkingAnimationStatus(false);
                }
                catch (Exception ex) { GracefullyFail(ex); }
            }));

            work.IsBackground = true;
            work.SetApartmentState(ApartmentState.STA);
            work.Start();
        }
        private void SendCrewToFacade(List<TraktPersonMovieJob> crew)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

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

            // filter movies
            var filteredCrew = FilterCrewMovies(crew).Where(m => !string.IsNullOrEmpty(m.Movie.Title)).ToList();

            // sort movies
            filteredCrew.Sort(new GUIListItemMovieSorter(TraktSettings.SortByCreditMovies.Field, TraktSettings.SortByCreditMovies.Direction));

            int itemId = 0;
            GUIMovieListItem item = null;
            var movieImages = new List<GUITmdbImage>();

            foreach (var job in filteredCrew)
            {
                // add image for download
                var images = new GUITmdbImage { MovieImages = new TmdbMovieImages { Id = job.Movie.Ids.Tmdb } };
                movieImages.Add(images);

                item = new GUIMovieListItem(job.Movie.Title, (int)TraktGUIWindows.PersonCreditMovies);
                item.Label2 = job.Movie.Year == null ? "----" : job.Movie.Year.ToString();
                item.Movie = job.Movie;
                item.TVTag = job;
                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++;
            }

            // 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}", filteredCrew.Count, filteredCrew.Count > 1 ? Translation.Movies : Translation.Movie));

            // Download movie images Async and set to facade
            GUIMovieListItem.GetImages(movieImages);
        }
        private void SendSearchResultsToFacade(IEnumerable <TraktPersonSummary> people)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (people == null || people.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound);
                GUIWindowManager.ShowPreviousWindow();
                People = null;
                return;
            }

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

            // Add each movie
            foreach (var person in people)
            {
                // add image for download
                var images = new TraktImage {
                    PoepleImages = person.Images
                };
                personImages.Add(images);

                var item = new GUIPersonListItem(person.Name.Trim(), (int)TraktGUIWindows.SearchPeople);

                item.TVTag           = person;
                item.Images          = images;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnPersonSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            if (SearchTermChanged)
            {
                PreviousSelectedIndex = 0;
            }
            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download images Async and set to facade
            GUIPersonListItem.GetImages(personImages);
        }
Beispiel #12
0
        private void SendSearchResultsToFacade(IEnumerable <TraktUser> users)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (users == null || users.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound);
                GUIWindowManager.ShowPreviousWindow();
                Users = null;
                return;
            }

            int itemId     = 0;
            var userImages = new List <TraktImage>();

            // Add each user
            foreach (var user in users)
            {
                // add image to download
                var images = new TraktImage {
                    Avatar = user.Avatar
                };
                userImages.Add(images);

                var item = new GUIUserListItem(user.Username, (int)TraktGUIWindows.SearchUsers);

                item.Images          = images;
                item.TVTag           = user;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = "defaultTraktUser.png";
                item.IconImageBig    = "defaultTraktUserBig.png";
                item.ThumbnailImage  = "defaultTraktUserBig.png";
                item.OnItemSelected += OnUserSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            if (SearchTermChanged)
            {
                PreviousSelectedIndex = 0;
            }
            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download images Async and set to facade
            GUIUserListItem.GetImages(userImages);
        }
Beispiel #13
0
        /// <summary>
        /// Called when an action is performed.
        /// </summary>
        /// <param name="action">The action.</param>
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
            {
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            base.OnAction(action);
        }
Beispiel #14
0
        /// <summary>
        /// If parental controls are enabled make sure the user is not up to no good.
        /// </summary>
        private bool VerifyParentalControls()
        {
            if (MovingPicturesCore.Settings.ParentalControlsEnabled && !MovingPicturesGUI.ValidatePin(GetID))
            {
                GUIWindowManager.ShowPreviousWindow();
                return(false);
            }

            return(true);
        }
Beispiel #15
0
 void stopCurrentItem()
 {
     if (g_Player.Playing)
     {
         if (GUIWindowManager.ActiveWindow == (int)GUIWindow.Window.WINDOW_TVFULLSCREEN)
         {
             GUIWindowManager.ShowPreviousWindow();
         }
         g_Player.Stop();
     }
 }
Beispiel #16
0
 private void ReturnToPreviousWindow()
 {
     if (GUIWindowManager.HasPreviousWindow())
     {
         GUIWindowManager.ShowPreviousWindow();
     }
     else
     {
         GUIWindowManager.CloseCurrentWindow();
     }
 }
 /// <summary>
 /// We need to know what to do when exiting GUI.
 /// If the GUI started with the video FULLSCREEN it replaced the fullscreen window. We have to handle that gracefully.
 /// This method does that for you.
 /// </summary>
 public static void exitGUI()
 {
     if (wasFullScreenVideo && GUIGraphicsContext.IsPlayingVideo)
     {
         GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO, true);
     }
     else
     {
         GUIWindowManager.ShowPreviousWindow();
     }
 }
        private void SendListItemsToFacade(TraktUserList list)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (list.Items == null || list.Items.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoListItemsFound);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            int itemId     = 1;
            var listImages = new List <TraktImage>();

            // Add each list item
            foreach (var listItem in list.Items.Where(l => !string.IsNullOrEmpty(l.Title)))
            {
                // add image for download
                var images = GetTraktImage(listItem);
                listImages.Add(images);

                string itemName = list.ShowNumbers ? string.Format("{0}. {1}", itemId, GetListItemName(listItem)) : GetListItemName(listItem);

                var item = new GUICustomListItem(itemName, (int)TraktGUIWindows.ListItems);

                item.Label2          = listItem.Year;
                item.TVTag           = listItem;
                item.Images          = images;
                item.IsPlayed        = listItem.Watched;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnItemSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download images Async and set to facade
            GUICustomListItem.GetImages(listImages);
        }
Beispiel #19
0
 private void DoBack()
 {
     if (grabber.Parent != null)
     {
         grabber.Prev();
         UpdateList();
     }
     else
     {
         GUIWindowManager.ShowPreviousWindow();
     }
 }
Beispiel #20
0
 public override void OnAction(Action action)
 {
     switch (action.wID)
     {
     case Action.ActionType.ACTION_PREVIOUS_MENU:
     {
         GUIWindowManager.ShowPreviousWindow();
         return;
     }
     }
     base.OnAction(action);
 }
Beispiel #21
0
        private void LoadDirectory()
        {
            int total = 0;

            GUIWaitCursor.Show();
            GUIControl.ClearControl(GetID, listConflicts.GetID);

            if (selectedItem == null)
            {
                IList <Conflict> conflictsList = Conflict.ListAll();
                foreach (Conflict conflict in conflictsList)
                {
                    Schedule schedule            = Schedule.Retrieve(conflict.IdSchedule);
                    Schedule conflictingSchedule = Schedule.Retrieve(conflict.IdConflictingSchedule);

                    GUIListItem item = Schedule2ListItem(schedule);
                    item.MusicTag = conflictingSchedule;
                    item.Label3   = conflictingSchedule.ProgramName;
                    item.IsFolder = true;
                    listConflicts.Add(item);
                    total++;
                }
            }
            else
            {
                Schedule schedule            = selectedItem.TVTag as Schedule;
                Schedule conflictingSchedule = selectedItem.MusicTag as Schedule;

                GUIListItem item = new GUIListItem();
                item.Label    = "..";
                item.IsFolder = true;
                listConflicts.Add(item);
                total++;

                item = Schedule2ListItem(schedule);
                listConflicts.Add(item);
                total++;

                item = Schedule2ListItem(conflictingSchedule);
                listConflicts.Add(item);
                SetLabels();
                total++;
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Utils.GetObjectCountLabel(total));

            GUIWaitCursor.Hide();
            if (listConflicts.Count == 0)
            {
                GUIWindowManager.ShowPreviousWindow();
            }
        }
Beispiel #22
0
        private void SendRelatedShowsToFacade(IEnumerable <TraktShow> shows)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (shows.Count() == 0)
            {
                string title = string.IsNullOrEmpty(relatedShow.Title) ? relatedShow.TVDbId : relatedShow.Title;
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoRelatedShows, title));
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            int itemId     = 0;
            var showImages = new List <TraktImage>();

            foreach (var show in shows)
            {
                var item = new GUIShowListItem(show.Title, (int)TraktGUIWindows.RelatedShows);

                // add image for download
                var images = new TraktImage {
                    ShowImages = show.Images
                };
                showImages.Add(images);

                item.Label2          = show.Year.ToString();
                item.TVTag           = show;
                item.Images          = images;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnShowSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download show images Async and set to facade
            GUIShowListItem.GetImages(showImages);
        }
Beispiel #23
0
        /// <summary>
        /// Checks that the current skin supports the importer. Backs out if it does not.
        /// </summary>
        private bool VerifySkinSupport()
        {
            bool skinSupported = allFilesListControl != null && pendingFilesListControl != null && completedFileListControl != null;

            if (!skinSupported)
            {
                GUIWindowManager.ShowPreviousWindow();
                MovingPicturesGUI.ShowMessage("Moving Pictures", Translation.SkinDoesNotSupportImporter, GetID);
                return(false);
            }

            return(true);
        }
Beispiel #24
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            // Init Properties
            if (!InitProperties())
            {
                // skin has missing features
                GUIUtils.ShowOKDialog(Translation.Error, Translation.SkinPluginsOutOfDate);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }
        }
        public override void Process()
        {
            if (!g_Player.Playing)
            {
                if (playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC ||
                    playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP)
                {
                    return;
                }

                GUIWindowManager.ShowPreviousWindow();
                return;
            }
        }
        private void SendListItemsToFacade(TraktUserList list)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (list.Items == null || list.Items.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoListItemsFound);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            int           itemId = 0;
            List <object> images = new List <object>();

            // Add each list item
            foreach (var listItem in list.Items)
            {
                GUITraktCustomListItem item = new GUITraktCustomListItem(listItem.ToString());

                item.Label2          = listItem.Year;
                item.TVTag           = listItem;
                item.Item            = listItem.Images;
                item.IsPlayed        = listItem.Watched;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = "defaultVideo.png";
                item.IconImageBig    = "defaultVideoBig.png";
                item.ThumbnailImage  = "defaultVideoBig.png";
                item.OnItemSelected += OnItemSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;

                // add image for download
                images.Add(listItem.Images);
            }

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

            Facade.SelectIndex(PreviousSelectedIndex);

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

            // Download images Async and set to facade
            GetImages(images);
        }
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_SHOW_PLAYLIST)
            {
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            else if (action.wID == Action.ActionType.ACTION_MOVE_SELECTED_ITEM_UP)
            {
                MovePlayListItemUp();
            }

            else if (action.wID == Action.ActionType.ACTION_MOVE_SELECTED_ITEM_DOWN)
            {
                MovePlayListItemDown();
            }

            else if (action.wID == Action.ActionType.ACTION_DELETE_SELECTED_ITEM)
            {
                DeletePlayListItem();
            }

            // Handle case where playlist has been stopped and we receive a player action.
            // This allows us to restart the playback proccess...
            else if (action.wID == Action.ActionType.ACTION_MUSIC_PLAY ||
                     action.wID == Action.ActionType.ACTION_NEXT_ITEM ||
                     action.wID == Action.ActionType.ACTION_PAUSE ||
                     action.wID == Action.ActionType.ACTION_PREV_ITEM
                     )
            {
                if (playlistPlayer.CurrentPlaylistType != PlayListType.PLAYLIST_MUSIC)
                {
                    playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;

                    if (string.IsNullOrEmpty(g_Player.CurrentFile))
                    {
                        PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);

                        if (playList != null && playList.Count > 0)
                        {
                            playlistPlayer.Play(0);
                            UpdateButtonStates();
                        }
                    }
                }
            }

            base.OnAction(action);
        }
        private void SendLikedListsToFacade(IEnumerable <TraktLike> likedItems)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

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

            int itemId = 0;

            // Add each list
            foreach (var likedItem in likedItems)
            {
                var item = new GUIListItem(likedItem.List.Name.RemapHighOrderChars());

                item.Label2          = string.Format("{0} {1}", likedItem.List.ItemCount, likedItem.List.ItemCount != 1 ? Translation.Items : Translation.Item);
                item.TVTag           = likedItem;
                item.ItemId          = Int32.MaxValue - itemId;
                item.PinImage        = TraktLists.GetPrivacyLevelIcon(likedItem.List.Privacy);
                item.IconImage       = "defaultFolder.png";
                item.IconImageBig    = "defaultFolderBig.png";
                item.ThumbnailImage  = "defaultFolderBig.png";
                item.OnItemSelected += OnItemSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

            // Set Facade Layout
            Facade.CurrentLayout = GUIFacadeControl.Layout.List;
            GUIControl.FocusControl(GetID, Facade.GetID);

            if (PreviousSelectedIndex >= likedItems.Count())
            {
                Facade.SelectIndex(PreviousSelectedIndex - 1);
            }
            else
            {
                Facade.SelectIndex(PreviousSelectedIndex);
            }

            // set facade properties
            GUIUtils.SetProperty("#itemcount", likedItems.Count().ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", likedItems.Count().ToString(), likedItems.Count() > 1 ? Translation.Lists : Translation.List));
        }
Beispiel #29
0
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
     {
         if (m_wndTetris != null && m_wndTetris.Focus && m_wndTetris.State == State.Running)
         {
             m_wndTetris.State = State.Paused;
         }
         else
         {
             GUIWindowManager.ShowPreviousWindow();
         }
     }
     else
     {
         base.OnAction(action);
     }
 }
Beispiel #30
0
        public override void OnAction(Action action)
        {
            if (LastActionTime + 100 > Environment.TickCount && action == LastAction)
            {
                return;
                // don't do anything if the keypress is comes to soon after the previos one and the action is the same as before.
            }

            switch (action.wID)
            {
            case Action.ActionType.ACTION_PREVIOUS_MENU:
            {
                GUIWindowManager.ShowPreviousWindow();
                return;
            }
            }
            base.OnAction(action);
        }