コード例 #1
0
        static void ProgramRegister(string Commands)
        {
            string MessageHelp = "TRegister" + " [1|10] [Reg|Unreg]";
            int    slot        = GetFirstParameterInteger(Commands, MessageHelp);
            string action      = GetSecondParameter(Commands);

            if (action != "REG" && action != "UNREG")
            {
                CrestronConsole.ConsoleCommandResponse(MessageHelp);
                return;
            }
            bool register = action == "REG" ? true : false;

            if (slot >= 1 && slot <= 10)
            {
                switch (slot)
                {
                case 1:
                    if (register)
                    {
                        _SystemControl.Program1_Register();
                    }
                    else
                    {
                        _SystemControl.Program1_Unregister();
                    }
                    break;

                case 2:
                    if (register)
                    {
                        _SystemControl.Program2_Register();
                    }
                    else
                    {
                        _SystemControl.Program2_Unregister();
                    }
                    break;

                case 3:
                    if (register)
                    {
                        _SystemControl.Program3_Register();
                    }
                    else
                    {
                        _SystemControl.Program3_Unregister();
                    }
                    break;

                case 4:
                    if (register)
                    {
                        _SystemControl.Program4_Register();
                    }
                    else
                    {
                        _SystemControl.Program4_Unregister();
                    }
                    break;

                case 5:
                    if (register)
                    {
                        _SystemControl.Program5_Register();
                    }
                    else
                    {
                        _SystemControl.Program5_Unregister();
                    }
                    break;

                case 6:
                    if (register)
                    {
                        _SystemControl.Program6_Register();
                    }
                    else
                    {
                        _SystemControl.Program6_Unregister();
                    }
                    break;

                case 7:
                    if (register)
                    {
                        _SystemControl.Program7_Register();
                    }
                    else
                    {
                        _SystemControl.Program7_Unregister();
                    }
                    break;

                case 8:
                    if (register)
                    {
                        _SystemControl.Program8_Register();
                    }
                    else
                    {
                        _SystemControl.Program8_Unregister();
                    }
                    break;

                case 9:
                    if (register)
                    {
                        _SystemControl.Program9_Register();
                    }
                    else
                    {
                        _SystemControl.Program9_Unregister();
                    }
                    break;

                case 10:
                    if (register)
                    {
                        _SystemControl.Program10_Register();
                    }
                    else
                    {
                        _SystemControl.Program10_Unregister();
                    }
                    break;

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