/// <summary> /// Turn the screen on or off as requested. Also optionally turn on/off JRMC music visualization /// </summary> /// <param name="mode">0: Off; 1: On/Normal; 2: On/Visualize (JRMC only)</param> public static void SetScreenDisplayMode( int mode) { logger.Info("SetScreenDisplayMode {0}", mode); if (mode == 0) { TurnOff(); if (Running.RunningProgram == "Music") { JRMC.SetDisplay(JRMC.DisplayMode.Mini); } } else { if (!Receiver.IsOn()) { Receiver.SelectTVOutput(); } TurnOn(); if (Running.RunningProgram == "Music") { JRMC.SetDisplay(mode == 2 ? JRMC.DisplayMode.Display : JRMC.DisplayMode.Standard); } } currentMode = mode; }
/// <summary> /// Launch the player applictaion (which will only be the Photo viewer) leaving any JRMC music still playing /// </summary> /// <param name="name"></param> /// <param name="args"></param> /// <returns></returns> public static bool LaunchNewProgram( string name, string args) { logger.Info("LaunchNewProgram {0} -> {1}", runningProgram, name); lastActive = DateTime.UtcNow; runningArgs = ""; if (name == "Photo") { if (runningProgram == "Photo") { ExitJRMC(); Thread.Sleep(500); } Zoom.Stop(); DvbViewer.Stop(); if (spotifyRunning) { Spotify.Stop(); } DesktopClient.ExitAllPrograms(); Receiver.SelectComputerInput(); Receiver.ReselectInput(); Screen.EnsureScreenOn(); Receiver.SelectRoomsOutput(); Screen.WaitForScreenOn(); runningProgram = "Photo"; if (DesktopClient.LaunchNewProgram(name, args)) { JRMC.SetDisplay(JRMC.DisplayMode.Display, maximize: true); logger.Info("LaunchProgram OK {0}", runningProgram); return(true); } } return(false); }
/// <summary> /// Launch a specified player application, closing any others as appropriate, and configuring /// the screen and receiver to suit the preferred outputs fr that player /// </summary> /// <param name="name"></param> /// <param name="args"></param> /// <returns></returns> public static bool LaunchProgram( string name, string args) { logger.Info("LaunchProgram {0} -> {1} {2}", runningProgram, name, args ?? ""); lastActive = DateTime.UtcNow; runningArgs = args; if (name != "Sky") { StopSky(); } if (name != "Roku") { StopRoku(); } Receiver.SelectComputerInput(); if (name == "Music") { if (runningProgram != name) { if (runningProgram == "Photo") { ExitJRMC(); } Zoom.Stop(); DvbViewer.Stop(); if (spotifyRunning) { Spotify.Stop(); } DesktopClient.ExitAllPrograms(); runningProgram = name; Screen.SetScreenDisplayMode(0); Receiver.SelectRoomsOutput(); } JRMC.SetDisplay(JRMC.DisplayMode.Standard, maximize: true); logger.Info("LaunchProgram OK {0}", runningProgram); return(true); } if (runningProgram == name && String.IsNullOrEmpty(args)) { if (runningProgram != "Spotify" && !DesktopClient.ForegroundProgram(name)) { Zoom.Stop(); DvbViewer.Stop(); if (spotifyRunning) { Spotify.Stop(); } DesktopClient.ExitAllPrograms(); NothingRunning(); return(false); } logger.Info("LaunchProgram OK {0}", runningProgram); return(true); } if (runningProgram == "Music" || runningProgram == "Photo") { ExitJRMC(); } if (runningProgram == "TV") { DvbViewer.Stop(); } runningProgram = name; switch (name) { default: return(false); case "TV": if (args != null && args == "Radio") { Screen.SetScreenDisplayMode(0); Receiver.SelectRoomsOutput(); } else { Screen.EnsureScreenOn(); Receiver.SelectTVOutput(); Screen.WaitForScreenOn(); } if (!DesktopClient.LaunchProgram("TV", null)) { NothingRunning(); return(false); } logger.Info("LaunchProgram OK {0}", runningProgram); return(true); case "Web": Screen.EnsureScreenOn(); Receiver.SelectTVOutput(); Screen.WaitForScreenOn(); if (!DesktopClient.LaunchProgram("Web", args)) { NothingRunning(); return(false); } logger.Info("LaunchProgram OK {0}", runningProgram); return(true); case "Video": Screen.EnsureScreenOn(); Receiver.SelectTVOutput(); //Screen.WaitForScreenOn(); if (args == null) { return(true); } if (!DesktopClient.LaunchProgram("Video", args)) { NothingRunning(); return(false); } zoomRunning = true; logger.Info("Zoom.Start"); Zoom.Start(); logger.Info("LaunchProgram OK {0}", runningProgram); return(true); case "Spotify": Screen.SetScreenDisplayMode(0); Receiver.SelectRoomsOutput(); DesktopClient.ExitAllPrograms(); DesktopClient.EnsureSpotifyRunning(); spotifyRunning = true; logger.Info("LaunchProgram OK {0}", runningProgram); return(true); } }