예제 #1
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED:
            {
                for (int i = 0; i < m_Facade.Count; ++i)
                {
                    GUIListItem item = m_Facade[i];
                    if (item != null && item.Selected)
                    {
                        item.Selected = false;
                        break;
                    }
                }
                UpdateButtonStates();
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_PLAYLIST_CHANGED:
            {
                // global playlist changed outside playlist window
                LoadDirectory(string.Empty);

                if (previousControlId == m_Facade.GetID && m_Facade.Count <= 0)
                {
                    previousControlId = btnViewAs.GetID;
                    GUIControl.FocusControl(GetID, previousControlId);
                }
                SelectCurrentVideo();
            }
            break;
            }
            return(base.OnMessage(message));
        }
예제 #2
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = _btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, _btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        var border = new Size(GUIGraphicsContext.form.Width - GUIGraphicsContext.form.ClientSize.Width,
                                              GUIGraphicsContext.form.Height - GUIGraphicsContext.form.ClientSize.Height);
                        if (GUIGraphicsContext.SkinSize.Width + border.Width <= GUIGraphicsContext.currentScreen.WorkingArea.Width &&
                            GUIGraphicsContext.SkinSize.Height + border.Height <= GUIGraphicsContext.currentScreen.WorkingArea.Height)
                        {
                            GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        }
                        else
                        {
                            double ratio = Math.Min((double)(GUIGraphicsContext.currentScreen.WorkingArea.Width - border.Width) / GUIGraphicsContext.SkinSize.Width,
                                                    (double)(GUIGraphicsContext.currentScreen.WorkingArea.Height - border.Height) / GUIGraphicsContext.SkinSize.Height);
                            GUIGraphicsContext.form.ClientSize = new Size((int)(GUIGraphicsContext.SkinSize.Width * ratio), (int)(GUIGraphicsContext.SkinSize.Height * ratio));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
예제 #3
0
        private void Update()
        {
            try
            {
                if (listExifProperties != null && !listExifProperties.IsVisible)
                {
                    listExifProperties.IsVisible = true;

                    if (!listExifProperties.IsEnabled)
                    {
                        GUIControl.EnableControl(GetID, listExifProperties.GetID);
                    }

                    GUIControl.SelectControl(GetID, listExifProperties.GetID);
                    GUIControl.FocusControl(GetID, listExifProperties.GetID);
                    GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(listExifProperties.Count));
                    listExifProperties.SelectedListItemIndex = _currentSelectedItem;
                    SelectItem();
                }

                if (imgPicture != null)
                {
                    imgPicture.Rotation = PictureDatabase.GetRotation(_currentPicture);
                    imgPicture.Dispose();
                    imgPicture.AllocResources();
                }

                GUIPropertyManager.SetProperty("#pictures.exif.picture", _currentPicture);
            }
            catch (Exception ex)
            {
                Log.Error("GUIPictureExif Update controls Error: {1}", ex.Message);
            }
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            currentLayout = Layout.Playlist;
            facadeLayout.CurrentLayout = currentLayout;

            LoadDirectory(string.Empty);
            if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO)
            {
                int iSong = playlistPlayer.CurrentSong;
                if (iSong >= 0 && iSong <= facadeLayout.Count)
                {
                    GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong);
                }
            }
            if (facadeLayout.Count <= 0)
            {
                GUIControl.FocusControl(GetID, btnLayouts.GetID);
                IMDBMovie movie = new IMDBMovie();
                movie.SetProperties(false, string.Empty);
            }


            using (Profile.Settings settings = new Profile.MPSettings())
            {
                playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("movies", "repeat", true);
            }

            if (btnRepeatPlaylist != null)
            {
                btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
            }
        }
예제 #7
0
        public void OnClicked(GUIControl control)
        {
            int controlId = control.GetID;

            if (controlId == 302)
            {
                SelectQuality(SelectedWatch);
            }
            if (controlId == 303)
            {
                SelectSource(SelectedWatch);
            }
            if (controlId == 304)
            {
                SelectTracker(SelectedWatch);
            }
            if (controlId == 305)
            {
                ChooseType(SelectedWatch);
            }
            if (controlId == 306)
            {
                OnToggleSpecials(SelectedWatch, control.Selected);
            }
            if (controlId == 307)
            {
                ChooseFolder(SelectedWatch);
            }
            if (controlId != 307)
            {
                GUIControl.FocusControl(5678, control.GetID);
            }
        }
예제 #8
0
        private void SelectCurrentPlayingSong()
        {
            if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC)
            {
                if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_MUSIC_PLAYLIST)
                {
                    // delete prev. selected item
                    for (int i = 0; i < facadeLayout.Count; ++i)
                    {
                        GUIListItem item = facadeLayout[i];
                        if (item != null && item.Selected)
                        {
                            item.Selected = false;
                            break;
                        }
                    }

                    // set current item selected
                    int iSong = playlistPlayer.CurrentSong;
                    if (iSong >= 0 && iSong <= facadeLayout.Count)
                    {
                        GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong);
                        GUIListItem item = facadeLayout[iSong];
                        if (item != null)
                        {
                            item.Selected = true;
                            GUIControl.FocusControl(GetID, facadeLayout.GetID);
                        }
                    }
                }
            }
        }
예제 #9
0
 protected override void OnPageLoad()
 {
     base.OnPageLoad();
     this.LoadSettings();
     GUIControl.FocusControl(this.GetID, this.btnRed.GetID);
     GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(109001));
 }
예제 #10
0
        /// <summary>
        /// Handles the event, when the Sorting method changes
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        private void SortChanged(object sender, SortEventArgs e)
        {
            CurrentSortAsc = e.Order != System.Windows.Forms.SortOrder.Descending;

            OnSort();
            GUIControl.FocusControl(GetID, ((GUIControl)sender).GetID);
        }
예제 #11
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();
            currentLayout = Layout.Playlist;
            facadeLayout.CurrentLayout = Layout.Playlist;

            LoadFacade();
            if (m_iItemSelected >= 0)
            {
                GUIControl.SelectItemControl(GetID, facadeLayout.GetID, m_iItemSelected);
            }
            if ((m_iLastControl == facadeLayout.GetID) && facadeLayout.Count <= 0)
            {
                m_iLastControl = btnNowPlaying.GetID;
                GUIControl.FocusControl(GetID, m_iLastControl);
            }
            if (facadeLayout.Count <= 0)
            {
                GUIControl.FocusControl(GetID, btnLayouts.GetID);
            }

            if (btnRepeatPlaylist != null)
            {
                btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
            }

            SelectCurrentPlayingSong();

            if (null != bw && bw.IsBusy && !bw.CancellationPending)
            {
                ShowWaitCursor();
            }
        }
예제 #12
0
        private void GetPrevEpisodeComments()
        {
            if (ShoutType != ShoutTypeEnum.episode)
            {
                return;
            }

            var episodeIndex = EpisodeInfo.EpisodeIdx;
            var seasonIndex  = EpisodeInfo.SeasonIdx;

            // there is no episode 0
            if (episodeIndex == 1)
            {
                return;
            }

            Comments = null;

            // decrement by 1 episode
            EpisodeInfo.EpisodeIdx = episodeIndex - 1;

            // flag to indicate we dont want to exit if no shouts found
            ExitIfNoShoutsFound = false;

            LoadCommentsList();

            // set focus back to facade
            GUIControl.FocusControl(GetID, Facade.GetID);
        }
        private void ShowAccountControls(bool newUser)
        {
            // set conditions so skins can show controls for account login/creation
            // there were issues when trying to invoke a virtual keyboard from a dialog
            // ie. (dialog from with-in another dialog) hence the reason why
            // we are re-using existing window to show controls.
            GUIUtils.SetProperty("#Trakt.Settings.Account.Dialog.Visible", "true");
            GUIUtils.SetProperty("#Trakt.Settings.Account.Dialog.NewUser", newUser.ToString().ToLowerInvariant());
            GUIWindowManager.Process();

            if (btnUsername != null)
            {
                GUIControl.FocusControl(GetID, btnUsername.GetID);
            }
            if (btnOk != null)
            {
                GUIControl.SetControlLabel(GetID, btnOk.GetID, newUser ? Translation.Create : Translation.Login);
            }
            if (lblTitle != null)
            {
                GUIControl.SetControlLabel(GetID, lblTitle.GetID, newUser ? Translation.CreateAccount : Translation.Login);
            }

            NewAccount = newUser;
        }
예제 #14
0
        protected override void OnPageLoad()
        {
            updateStationLogoTimer.Enabled = true;

            _setting = Settings.Instance;
            grabber.Settings.User      = _setting.User;
            grabber.Settings.Password  = _setting.Password;
            grabber.Settings.PartnerId = _setting.PartnerId;
            LoadLocalPresetStations();

            if (String.IsNullOrEmpty(GUIPropertyManager.GetProperty("#RadioTime.Presets.Folder.Name").Trim()))
            {
                GUIControl.DisableControl(GetID, folderButton.GetID);
            }
            else
            {
                GUIControl.EnableControl(GetID, folderButton.GetID);
            }

            foreach (var name in Translation.Strings.Keys)
            {
                SetProperty("#RadioTime.Translation." + name + ".Label", Translation.Strings[name]);
            }

            GUIControl.FocusControl(GetID, GetFocusControlId());

            base.OnPageLoad();
        }
        private void HideAccountControls()
        {
            Username = string.Empty;
            Password = string.Empty;
            Email    = string.Empty;

            if (btnUsername != null)
            {
                GUIControl.SetControlLabel(GetID, btnUsername.GetID, string.Empty);
            }
            if (btnPassword != null)
            {
                GUIControl.SetControlLabel(GetID, btnPassword.GetID, string.Empty);
            }
            if (btnEmail != null)
            {
                GUIControl.SetControlLabel(GetID, btnEmail.GetID, string.Empty);
            }
            if (lblTestConnect != null)
            {
                GUIControl.SetControlLabel(GetID, lblTestConnect.GetID, string.Empty);
            }

            GUIUtils.SetProperty("#Trakt.Settings.Account.Dialog.Visible", "false");
            GUIWindowManager.Process();

            // Set Focus back to main window controls
            if (btnCreateNewAccount != null)
            {
                GUIControl.FocusControl(GetID, btnCreateNewAccount.GetID);
            }
        }
        protected override void OnPageLoad()
        {
            base.OnPageLoad();
            //Load settings
            Log.Info("GUISkipSteps: {0}", "Load settings");
            string regValue = string.Empty;

            using (Settings xmlreader = new MPSettings())
            {
                try
                {
                    regValue = xmlreader.GetValueAsString("movieplayer", "skipsteps", DEFAULT_SETTING);
                    if (regValue == string.Empty) // config after wizard run 1st
                    {
                        regValue = DEFAULT_SETTING;
                        Log.Info("GeneralSkipSteps - creating new Skip-Settings {0}", "");
                    }
                    else if (OldStyle(regValue))
                    {
                        regValue = ConvertToNewStyle(regValue);
                    }
                    labelCurrent.Label = regValue;
                }
                catch (Exception ex)
                {
                    Log.Info("GeneralSkipSteps - Exception while loading Skip-Settings: {0}", ex.ToString());
                }
            }
            SetCheckMarksBasedOnString(regValue);

            GUIControl.FocusControl(GetID, checkMarkButtonStep1.GetID);
        }
예제 #17
0
        protected override void OnPageLoad()
        {
            foreach (GUIListItem item in relatated)
            {
                listControl.Add(item);
            }
            //updateStationLogoTimer.Enabled = true;

            //if (Youtube2MP.NowPlayingEntry != null)
            //{
            //  if (File.Exists(GetFanArtImage(Youtube2MP.NowPlayingSong.Artist)))
            //  {
            //    GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", GetFanArtImage(Youtube2MP.NowPlayingSong.Artist));
            //    imgFanArt.Visible = true;
            //    updateStationLogoTimer.Enabled = false;
            //  }
            //  else
            //  {
            //    imgFanArt.Visible = false;
            //    updateStationLogoTimer.Enabled = true;
            //  }


            //}
            GUIControl.FocusControl(GetID, listControl.GetID);
            base.OnPageLoad();
        }
예제 #18
0
        protected override void OnShowSort()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(495);         // Sort options

            dlg.AddLocalizedString(103); // name
            dlg.AddLocalizedString(668); // Type
            dlg.AddLocalizedString(669); // genre
            dlg.AddLocalizedString(670); // bitrate
            dlg.AddLocalizedString(620); // number

            dlg.SelectedLabel = (int)currentSortMethod;

            // show dialog and wait for result
            dlg.DoModal(GetID);
            if (dlg.SelectedId == -1)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case 103:
                currentSortMethod = SortMethod.Name;
                break;

            case 668:
                currentSortMethod = SortMethod.Type;
                break;

            case 669:
                currentSortMethod = SortMethod.Genre;
                break;

            case 670:
                currentSortMethod = SortMethod.Bitrate;
                break;

            case 620:
                currentSortMethod = SortMethod.Number;
                break;

            default:
                currentSortMethod = SortMethod.Name;
                break;
            }

            OnSort();
            if (btnSortBy != null)
            {
                GUIControl.FocusControl(GetID, btnSortBy.GetID);
            }
        }
예제 #19
0
        private void ShowPosters()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);
            List <PosterContainer> allPosters = new List <PosterContainer>();

            string displayname = "";

            AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID);

            if (ser != null)
            {
                displayname = ser.SeriesName;
                if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0)
                {
                    AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID;
                }
            }

            BaseConfig.MyAnimeLog.Write("ShowPosters for {0} - {1}", displayname, AnimeID);

            foreach (PosterContainer pstr in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllPosters)
            {
                if (!File.Exists(pstr.FullImagePath))
                {
                    continue;
                }

                allPosters.Add(pstr);
            }

            GUIListItem item = null;

            foreach (PosterContainer poster in allPosters)
            {
                item                 = new GUIListItem();
                item.IconImage       = item.IconImageBig = poster.FullImagePath;
                item.TVTag           = poster;
                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                m_Facade.Add(item);
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                // Work around for Filmstrip not allowing to programmatically select item
                if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip)
                {
                }

                PosterContainer selectedPoster = m_Facade.SelectedListItem.TVTag as PosterContainer;
                if (selectedPoster != null)
                {
                    SetPosterProperties(selectedPoster);
                }

                GUIControl.FocusControl(GetID, 50);
            }
        }
예제 #20
0
        private void SendSearchResultsToFacade(IEnumerable <TraktSearchResult> searchResults)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (searchResults == null || searchResults.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoSearchResultsFound);
                return;
            }

            // jump directly to results
            if (!TraktSettings.ShowSearchResultsBreakdown && SearchTypes.Count == 1)
            {
                // set the selected search type as we have not clicked on a facade item
                SelectedSearchType = (SearchType)GetSearchTypesID();
                SendSearchResultsToWindow(SearchResults);

                // clear the search term so when we return (press back) we don't go in a loop.
                SearchTerm = null;
                return;
            }

            int itemId = 0;

            // Add each search type to the list
            foreach (var type in SearchTypes)
            {
                GUIListItem item = new GUIListItem(GetSearchListName(type));

                item.Label2          = GetSearchResultCount(searchResults, type).ToString();
                item.ItemId          = Int32.MaxValue - itemId;
                item.TVTag           = type;
                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.SetCurrentLayout("List");
            GUIControl.FocusControl(GetID, Facade.GetID);

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

            // set facade properties
            GUIUtils.SetProperty("#itemcount", SearchTypes.Count().ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", SearchTypes.Count.ToString(), Translation.SearchTypes));
        }
예제 #21
0
        private void SortChanged(object sender, SortEventArgs e)
        {
            CurrentSortAsc = e.Order != SortOrder.Descending;

            OnSort();
            //UpdateButtonStates();
            GUIControl.FocusControl(GetID, ((GUIControl)sender).GetID);
        }
예제 #22
0
        public void PresentLayout()
        {
            GUIControl.HideControl(GetID, facadeLayout.GetID);
            int iControl = facadeLayout.GetID;

            GUIControl.ShowControl(GetID, iControl);
            GUIControl.FocusControl(GetID, iControl);
        }
예제 #23
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);
        }
예제 #24
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);
        }
        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);
        }
        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);
        }
 void SortChanged(object sender, SortEventArgs e)
 {
     // save the new state
     mapSettings.SortAscending = e.Order != SortOrder.Descending;
     // update the list
     //UpdateList();
     //UpdateButtonStates();
     GUIControl.FocusControl(GetID, ((GUIControl)sender).GetID);
 }
        public override bool OnMessage(GUIMessage message)
        {
            //needRefresh = true;
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                SetControlLabel(GetID, 1, string.Empty);
                base.OnMessage(message);
                return(true);
            }

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                m_bConfirmed = false;
                base.OnMessage(message);
                if (m_DefaultYes)
                {
                    GUIControl.FocusControl(GetID, btnYes.GetID);
                }
                iYesKey = (int)btnYes.Label.ToLower()[0];
                iNoKey  = (int)btnNo.Label.ToLower()[0];
            }
                return(true);

            case GUIMessage.MessageType.GUI_MSG_CLICKED:
            {
                int iControl = message.SenderControlId;

                if (btnYes == null)
                {
                    m_bConfirmed = true;
                    PageDestroy();
                    m_DefaultYes = false;
                    return(true);
                }
                if (iControl == btnNo.GetID)
                {
                    m_bConfirmed = false;
                    PageDestroy();
                    m_DefaultYes = false;
                    return(true);
                }
                if (iControl == btnYes.GetID)
                {
                    m_bConfirmed = true;
                    PageDestroy();
                    m_DefaultYes = false;
                    return(true);
                }
            }
            break;
            }

            return(base.OnMessage(message));
        }
        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);
        }