Exemple #1
0
 void newGUIHandler_OnPreviewVideoStatusChanged(string filename, bool loop)
 {
     GUIWindowManager.SendThreadCallback((p1, p2, o) =>
     {
         string playing;
         previewVidFilename = filename;
         if (string.IsNullOrEmpty(filename))
         {
             if (g_Player.Playing)
             {
                 g_Player.Stop();
             }
             GUIGraphicsContext.ShowBackground = true;
             playing = "no";
         }
         else
         {
             previewVidLoop    = loop;
             previewVidPlaying = true;
             GUIGraphicsContext.ShowBackground = false;
             g_Player.Play(filename, MediaPortal.Player.g_Player.MediaType.Video);
             playing = "yes";
         }
         GUIPropertyManager.SetProperty("#Emulators2.PreviewVideo.playing", playing);
         return(0);
     }
                                         , 0, 0, null);
 }
        void updateFacade(object state)
        {
            lock (refreshSync)
            {
                if (!facadeNeedsUpdate)
                {
                    return;
                }

                facadeNeedsUpdate = false;
                GUIWindowManager.SendThreadCallback(refreshCallback, 0, 0, null);
            }
        }
 void invoke(System.Action action, bool wait = true)
 {
     if (wait)
     {
         GUIWindowManager.SendThreadCallbackAndWait((p1, p2, o) =>
         {
             action();
             return(0);
         }, 0, 0, null);
     }
     else
     {
         GUIWindowManager.SendThreadCallback((p1, p2, o) =>
         {
             action();
             return(0);
         }, 0, 0, null);
     }
 }
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_KEY_PRESSED)
            {
                // translate the action as if our window was the WINDOW_FULLSCREEN_VIDEO
                if (ActionTranslator.GetAction((int)Window.WINDOW_FULLSCREEN_VIDEO, action.m_key, ref action))
                {
                    if (action.wID == Action.ActionType.ACTION_SHOW_OSD)                     // handle the OSD action differently - we need to show our OSD
                    {
                        base.OnAction(action);
                        if (GUIWindowManager.VisibleOsd == Window.WINDOW_OSD)
                        {
                            GUIWindowManager.VisibleOsd = (Window)GUIOnlineVideoOSD.WINDOW_ONLINEVIDEOS_OSD;
                        }
                        return;
                    }
                    else if (action.wID == Action.ActionType.ACTION_SHOW_GUI ||
                             action.wID == Action.ActionType.ACTION_NEXT_SUBTITLE)
                    {
                        return;                         // already handled by base class, but get's sent here again as keypress, so when we map it we must make sure not to handle it again
                    }
                    else if (action.wID == Action.ActionType.ACTION_VOLUME_UP ||
                             action.wID == Action.ActionType.ACTION_VOLUME_DOWN ||
                             action.wID == Action.ActionType.ACTION_VOLUME_MUTE)
                    {
                        // MediaPortal core sends this message to the Fullscreenwindow, we need to do it ourselves to make the Volume OSD show up
                        GUIWindowManager.SendThreadCallback((p1, p2, o) =>
                        {
                            Action showVolume = new Action(Action.ActionType.ACTION_SHOW_VOLUME, 0, 0);
                            GUIWindowManager.OnAction(showVolume);
                            return(0);
                        }, 0, 0, null);
                        return;
                    }
                }
            }

            base.OnAction(action);
        }
        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);
        }