コード例 #1
0
        static void ProgramStart(string Commands)
        {
            string MessageHelp = "TProgram" + " [1|10] [Start|Stop]";
            int    slot        = GetFirstParameterInteger(Commands, MessageHelp);
            string action      = GetSecondParameter(Commands);

            if (action != "START" && action != "STOP")
            {
                CrestronConsole.ConsoleCommandResponse(MessageHelp);
                return;
            }
            bool start = action == "START"?true:false;

            if (slot >= 1 && slot <= 10)
            {
                switch (slot)
                {
                case 1:
                    if (start)
                    {
                        _SystemControl.Program1_Start();
                    }
                    else
                    {
                        _SystemControl.Program1_Stop();
                    }
                    break;

                case 2:
                    if (start)
                    {
                        _SystemControl.Program2_Start();
                    }
                    else
                    {
                        _SystemControl.Program2_Stop();
                    }
                    break;

                case 3:
                    if (start)
                    {
                        _SystemControl.Program3_Start();
                    }
                    else
                    {
                        _SystemControl.Program3_Stop();
                    }
                    break;

                case 4:
                    if (start)
                    {
                        _SystemControl.Program4_Start();
                    }
                    else
                    {
                        _SystemControl.Program4_Stop();
                    }
                    break;

                case 5:
                    if (start)
                    {
                        _SystemControl.Program5_Start();
                    }
                    else
                    {
                        _SystemControl.Program5_Stop();
                    }
                    break;

                case 6:
                    if (start)
                    {
                        _SystemControl.Program6_Start();
                    }
                    else
                    {
                        _SystemControl.Program6_Stop();
                    }
                    break;

                case 7:
                    if (start)
                    {
                        _SystemControl.Program7_Start();
                    }
                    else
                    {
                        _SystemControl.Program7_Stop();
                    }
                    break;

                case 8:
                    if (start)
                    {
                        _SystemControl.Program8_Start();
                    }
                    else
                    {
                        _SystemControl.Program8_Stop();
                    }
                    break;

                case 9:
                    if (start)
                    {
                        _SystemControl.Program9_Start();
                    }
                    else
                    {
                        _SystemControl.Program9_Stop();
                    }
                    break;

                case 10:
                    if (start)
                    {
                        _SystemControl.Program10_Start();
                    }
                    else
                    {
                        _SystemControl.Program10_Stop();
                    }
                    break;

                default:
                    break;
                }
                CrestronConsole.ConsoleCommandResponse("CMD:Changing Program {0} to {1}...\n", slot, action);
            }
            else
            {
                CrestronConsole.ConsoleCommandResponse(MessageHelp);
            }
        }