Beispiel #1
0
        /* The following code was referenced from the Moving Pictures plugin */
        static void suspendMP(bool suspend)
        {
            if (suspend) //suspend and hide MediaPortal
            {
                Logger.LogDebug("Suspending MediaPortal...");
                // disable mediaportal input devices
                InputDevices.Stop();

                // hide mediaportal and suspend rendering to save resources for the pc game
                GUIGraphicsContext.BlankScreen = true;
                GUIGraphicsContext.form.Hide();
                GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.SUSPENDING;
            }
            else //resume Mediaportal
            {
                Logger.LogDebug("Resuming MediaPortal...");

                InputDevices.Init();
                // Resume Mediaportal rendering
                GUIGraphicsContext.BlankScreen = false;
                GUIGraphicsContext.form.Show();
                GUIGraphicsContext.ResetLastActivity();
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null);
                GUIWindowManager.SendThreadMessage(msg);
                GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.RUNNING;
            }
        }
        /// <summary>
        /// Suspend mediaportal and hide the window
        /// </summary>
        /// <param name="suspend"></param>
        void SuspendMP(bool suspend)
        {
            if (suspend && _mpWindowHidden)
            {
                return;                             // Should already be suspended
            }
            if (!suspend && !_mpWindowHidden)
            {
                return;              // Should already be visible
            }
            if (suspend)             //suspend and hide MediaPortal
            {
                InputDevices.Stop(); //stop input devices so they don't interfere when the browser player starts listening
                GUIWindowManager.OnNewAction += GUIWindowManager_OnNewAction;

                // Minimise MePo to tray - this is preferrable
                ToggleMinimise(true);

                _mpWindowHidden = true;
            }
            else //resume Mediaportal
            {
                GUIWindowManager.OnNewAction -= GUIWindowManager_OnNewAction;

                InputDevices.Init();

                // Resume Mediaportal rendering
                ToggleMinimise(false);

                ProcessHelper.SetForeground("mediaportal");

                GUIGraphicsContext.ResetLastActivity();


                _mpWindowHidden = false;
            }
        }