コード例 #1
0
ファイル: GUIRSSFeed.cs プロジェクト: c3333/MediaPortal-1
        private void UpdateButtons()
        {
            GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_BTNREFRESH, GUILocalizeStrings.Get(184)); //Refresh
            GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LABELCHANNEL, m_strDescription);          //Channel name label
            GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(9) + @"/" + m_strSiteName);

            int posX = m_pSiteImage.XPosition;
            int posY = m_pSiteImage.YPosition;

            m_pSiteImage.SetPosition(posX, posY);
            m_pSiteImage.ColourDiffuse = 0xffffffff;
            m_pSiteImage.SetFileName(m_strSiteIcon);

            //			m_pSiteImage.Width = m_pSiteImage.TextureWidth;
            //			m_pSiteImage.Height = m_pSiteImage.TextureHeight;

            GUIControl.ClearControl(GetID, (int)Controls.CONTROL_LIST);

            int iTotalItems = 0;

            foreach (feed_details feed in m_feed_details)
            {
                if (feed.m_title == "" && feed.m_description == "")
                {
                    // Skip this empty item
                    continue;
                }

                GUIListItem item = new GUIListItem();
                item.Label          = feed.m_title;
                item.IsFolder       = false;
                item.MusicTag       = feed;
                item.ThumbnailImage = "";
                item.IconImage      = "defaultMyNews.png";

                GUIControl.AddListItemControl(GetID, (int)Controls.CONTROL_LIST, item);
                iTotalItems++;
            }

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

            GUIControl.FocusControl(GetID, (int)Controls.CONTROL_LIST);

            GUIListItem selecteditem = GUIControl.GetSelectedListItem(GetID, (int)Controls.CONTROL_LIST);

            if (selecteditem != null)
            {
                GUIPropertyManager.SetProperty("#selecteditem", selecteditem.Label);
            }

            GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_STORYTEXT, m_feed_details[0].m_description);
        }
コード例 #2
0
ファイル: GUIPresenter.cs プロジェクト: brownard/MyEmulators2
        public void Sort()
        {
            if (facadeItems == null || facadeItems.Count < 1)
            {
                return;
            }

            facadeItems.Sort(new ListItemComparer(sortProperty, !sortAsc));

            GUIControl.ClearControl(Plugin.WINDOW_ID, facade.GetID);
            for (int i = 0; i < facadeItems.Count; i++)
            {
                if (showSortValue)
                {
                    facadeItems[i].SetLabel2(sortProperty);
                }
                GUIControl.AddListItemControl(Plugin.WINDOW_ID, facade.GetID, facadeItems[i]);
            }
            setFacadeIndex(0);
        }
コード例 #3
0
ファイル: GUIPresenter.cs プロジェクト: brownard/MyEmulators2
        bool setItemsToFacade <T>(IEnumerable <T> items, ExtendedGUIListItem parent, int parentIndex, int selectedIndex) where T : DBItem
        {
            bool sortable = false;

            facadeItems = new List <ExtendedGUIListItem>();
            lock (gameItemLock)
            {
                gameItems = new Dictionary <int, ExtendedGUIListItem>();
                int listPosition = 0;
                foreach (DBItem item in items)
                {
                    ExtendedGUIListItem facadeItem = item.CreateGUIListItem();
                    if (facadeItem.AssociatedGame != null)
                    {
                        gameItems[facadeItem.AssociatedGame.GameID] = facadeItem;
                    }
                    sortable = sortable || facadeItem.Sortable;
                    facadeItem.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                    facadeItem.Parent          = parent;
                    facadeItem.ParentIndex     = parentIndex;
                    facadeItem.ListPosition    = listPosition;
                    listPosition++;
                    facadeItems.Add(facadeItem);
                }
            }

            if (facadeItems.Count < 1)
            {
                return(false);
            }

            if (sortable)
            {
                SortEnabled = true;
                if (sortProperty != ListItemProperty.DEFAULT)
                {
                    facadeItems.Sort(new ListItemComparer(sortProperty, !sortAsc));
                }
                else
                {
                    sortable = false;
                }
            }
            else
            {
                SortProperty = ListItemProperty.DEFAULT;
                SortEnabled  = false;
            }

            GUIPropertyManager.SetProperty("#Emulators2.currentfilter", parent != null ? parent.Label : startupState.Translate());
            sortable = sortable && showSortValue;

            GUIControl.ClearControl(Plugin.WINDOW_ID, facade.GetID);
            for (int i = 0; i < facadeItems.Count; i++)
            {
                if (sortable)
                {
                    facadeItems[i].SetLabel2(sortProperty);
                }
                GUIControl.AddListItemControl(Plugin.WINDOW_ID, facade.GetID, facadeItems[i]);
            }

            setFacadeIndex(selectedIndex);

            if (currentView != ViewState.Details)
            {
                onFacadeItemSelected(facade.SelectedListItem, facade);
            }

            return(true);
        }
コード例 #4
0
ファイル: GUIPresenter.cs プロジェクト: brownard/MyEmulators2
        void gameSelected(ExtendedGUIListItem selectedItem, bool lClickToDetails)
        {
            if (selectedItem == null)
            {
                return;
            }
            Game selectedGame = selectedItem.AssociatedGame;

            if (selectedGame == null)
            {
                return;
            }

            int           itemCount         = 0;
            int           selectedGoodmerge = -1;
            List <string> goodMergeGames    = null;

            if (selectedGame.IsGoodmerge)
            {
                try
                {
                    goodMergeGames = Extractor.Instance.ViewFiles(selectedGame, out selectedGoodmerge);
                }
                catch (ExtractException) { }

                if (goodMergeGames != null)
                {
                    if (goodMergeGames.Count < 1)
                    {
                        goodMergeGames = null;
                    }
                    else
                    {
                        itemCount = goodMergeGames.Count;
                    }
                }

                selectedGame.GoodmergeFiles = goodMergeGames;
            }


            if (goodmergeList != null)
            {
                GUIControl.ClearControl(Plugin.WINDOW_ID, goodmergeList.GetID);
            }

            if (goodMergeGames != null)
            {
                if (selectedGoodmerge < 0 || selectedGoodmerge >= goodMergeGames.Count)
                {
                    selectedGoodmerge = 0;
                }

                if (lClickToDetails && goodmergeList != null)
                {
                    selectedGame.CurrentDisc.LaunchFile = goodMergeGames[selectedGoodmerge];
                    bool selected = false;
                    for (int x = 0; x < goodMergeGames.Count; x++)
                    {
                        GUIListItem item = new GUIListItem(goodMergeGames[x].Replace(selectedGame.Filename, "").Trim())
                        {
                            DVDLabel = goodMergeGames[x]
                        };
                        GUIControl.AddListItemControl(Plugin.WINDOW_ID, goodmergeList.GetID, item);
                        if (!selected && x == selectedGoodmerge)
                        {
                            selected      = true;
                            item.Selected = true;
                            goodmergeList.SelectedListItemIndex = x;
                        }
                    }
                }
                else if (selectedGame.CurrentDisc.LaunchFile != goodMergeGames[selectedGoodmerge])
                {
                    selectedGame.CurrentDisc.LaunchFile = "";
                }
            }

            GUIPropertyManager.SetProperty("#Emulators2.CurrentItem.goodmergecount", itemCount.ToString());
            if (lClickToDetails)
            {
                toggleDetails(selectedItem);
            }
            else
            {
                launchGame(selectedGame);
            }
        }