Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 public static void StopZoom()
 {
     if (runningProgram == "Video" && zoomRunning)
     {
         Zoom.Stop();
         DesktopClient.ExitProgram("Video");
     }
     zoomRunning = false;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Assert (and ensure) that nothing is running
 /// </summary>
 static void NothingRunning()
 {
     Zoom.Stop();
     zoomRunning = false;
     DvbViewer.Stop();
     if (spotifyRunning)
     {
         Spotify.Stop();
     }
     runningProgram = "";
     logger.Info("NothingRunning");
 }
Ejemplo n.º 3
0
    /// <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);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Note that we are starting the Sky box, and so stop all media PC player applications
    /// </summary>
    /// <returns></returns>
    public static bool StartSky()
    {
        logger.Info("StartSky");

        if (runningProgram != "Sky")
        {
            if (runningProgram == "Music" || runningProgram == "Photo")
            {
                ExitJRMC();
            }

            DesktopClient.ExitAllPrograms();
            DesktopClient.SendSpecialkey("ClearDesktop");
            Zoom.Stop();
            DvbViewer.Stop();
            if (spotifyRunning)
            {
                Spotify.Stop();
            }
        }

        runningProgram = "Sky";
        return(true);
    }
Ejemplo n.º 5
0
    /// <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);
        }
    }