motey / MPSteam

Tiny plugin for MediaPortal for starting Valves Steam from Homemenu
Other
1 stars 0 forks source link

Kill / suspend MP when Steam starts #7

Closed motey closed 10 years ago

motey commented 11 years ago

Option to kill MP when steam starts (maybe increases Gaming perfomance) (Add tip to link MP in Steam to get back to MP)

motey commented 11 years ago

Hatte halt gehofft, daß die MP-Api eine Methode anbietet um einen shutdown-Befehl auszulösen. Schaut aber nicht so aus, nachdem ich mich mal ein bischen durch den Code gewühlt habe. Plan B war jetzt den Code von http://www.team-mediaportal.com/extensions/other/powerscheduler zu durchwühlen, weil das Plugin, wenn ich es recht in Erinnerung habe, anbietet MP zu schließen. Leider hab ich auf die schnelle den Quellcode nicht gefunden.

motey commented 11 years ago

http://forum.team-mediaportal.com/threads/shutdown-exit-mediaportal.119136/

motey commented 11 years ago

its so easy :) http://msdn.microsoft.com/de-de/library/system.diagnostics.process.closemainwindow.aspx used by MPextended for example: https://github.com/MPExtended/MPExtended/blob/master/Services/MPExtended.Services.UserSessionService/UserSessionService.cs#L211

motey commented 11 years ago

I think a simple process will do it

motey commented 10 years ago

found this method in myEmulator2 http://myemulators2.googlecode.com/svn/trunk/Launcher/Executor.cs:

/* 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;
        }
    }

We could implement the Option to supsend MediaPortal instead of Killing it. looks very simple

jensbuehl commented 10 years ago

Just commited the suspend / resume. It works if you exit Steam but not if you choose "exit to desktop" -> in that case steam is still running in tray -> MP is not resumed!

I think we have to fix this or at least make it optional.

jensbuehl commented 10 years ago

Also did the configuration part yesterday. Just have to test it and will commit it somewhen this week...