Beispiel #1
0
        void toggleDetails(ExtendedGUIListItem detailsItem, bool hide = false)
        {
            int controlId;

            setFacadeVisibility(hide);
            if (hide)
            {
                currentView = ViewState.Items;
                controlId   = facade.GetID;
                ExtendedGUIListItem item = (ExtendedGUIListItem)facade.SelectedListItem;
                if (this.detailsItem != null && item != null && item.AssociatedGame != null && this.detailsItem.AssociatedGame.GameID == item.AssociatedGame.GameID)
                {
                    item.UpdateGameInfo(this.detailsItem.AssociatedGame);
                }
                this.detailsItem = null;
                onFacadeItemSelected(facade.SelectedListItem, facade);
            }
            else
            {
                currentView      = ViewState.Details;
                controlId        = detailsDefaultControl;
                this.detailsItem = detailsItem;
                if (detailsItem != null)
                {
                    onFacadeItemSelected(detailsItem, facade, true);
                }
            }
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, Plugin.WINDOW_ID, 0, controlId, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
Beispiel #2
0
        public void UpdateGame(Game game)
        {
            if (game == null)
            {
                return;
            }

            ExtendedGUIListItem item = null;

            lock (gameItemLock)
                if (gameItems == null || !gameItems.TryGetValue(game.GameID, out item))
                {
                    return;
                }

            GUIWindowManager.SendThreadCallback((a, b, c) =>
            {
                item.UpdateGameInfo(game);
                if (facade != null && facade.SelectedListItem == item)
                {
                    if (currentView == ViewState.Details)
                    {
                        if (detailsItem != null && detailsItem.AssociatedGame != null && item.AssociatedGame != null && detailsItem.AssociatedGame.GameID == item.AssociatedGame.GameID)
                        {
                            toggleDetails(item);
                        }
                    }
                    else
                    {
                        item.ItemSelected(facade);
                    }
                }

                return(0);
            }, 0, 0, null);
        }