コード例 #1
0
        static void Main(string[] args)
        {
            //Chenillard Console
            int     speedCmd     = 500;
            string  LED          = null;
            string  command      = null;
            Boolean loopContinue = true;

            Console.WriteLine($@"=============***>>>>>>>                            <<<<<<<<<<<******==========
                    Welcome to the Chenillard console ");
            Chenillard chenillardContol = new Chenillard();

            while (true && loopContinue == true)
            {
                Console.WriteLine("Start the chenillard by pressing [V], stop chenillard with [C], select your speed with [S]. To quit, press [Q]. To change Order, press [O]. Actual speed : " + chenillardContol.speed + "ms");
                command = Console.ReadLine();
                switch (command)
                {
                case "V":
                    chenillardContol.startChenillard();
                    break;

                case "C":
                    chenillardContol.stopChenillard();
                    break;

                case "S":
                    Console.WriteLine("Choose your Speed : ");
                    speedCmd = Convert.ToInt32(Console.ReadLine());
                    chenillardContol.speed = speedCmd;
                    break;

                case "O":
                    Console.WriteLine("Choose Order :");
                    Console.WriteLine("LED1 :");
                    LED = Console.ReadLine();
                    chenillardContol.Led1 = LED;
                    Console.WriteLine("LED2 :");
                    LED = Console.ReadLine();
                    chenillardContol.Led2 = LED;
                    Console.WriteLine("LED3 :");
                    LED = Console.ReadLine();
                    chenillardContol.Led3 = LED;
                    Console.WriteLine("LED4 :");
                    LED = Console.ReadLine();
                    chenillardContol.Led4 = LED;

                    chenillardContol.changeOrder();
                    break;

                case "Q":
                    Console.WriteLine("Exiting..");
                    loopContinue = false;
                    break;
                }
            }

            Console.WriteLine("End... ");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Darchevil/KnxChenillard
        static void Main(string[] args)
        {
            int     speedCmd     = 500;
            string  LED          = null;
            string  command      = null;
            Boolean loopContinue = true;

            Console.WriteLine("Connected !");

            while (true && loopContinue == true)
            {
                Console.WriteLine($@"Welcome ! Choose your Action :
                      [V] : Start chenillard
                      [C] : stop chenillard
                      [S] : Choose Speed 
                      [O] : Change Order 
                      [Q] : Quit
                      Actual speed : " + chenillard.speed);

                command = Console.ReadLine();
                switch (command)
                {
                case "V":
                    chenillard.StartChenillard();
                    break;

                case "C":
                    chenillard.StopChenillard();
                    break;

                case "S":
                    Console.WriteLine("Choose Your Speed in ms (minimum 500) :");
                    speedCmd         = Convert.ToInt32(Console.ReadLine());
                    chenillard.speed = speedCmd;
                    break;

                case "O":
                    Console.WriteLine($@"Actual Order:
                      [LED1] : {chenillard.Led1}
                      [LED2] : {chenillard.Led2}
                      [LED3] : {chenillard.Led3}
                      [LED4] : {chenillard.Led4}");

                    Console.WriteLine("Choose Order by adding Led Addresses X/X/X Type Q to Cancel : ");
                    Console.WriteLine("LED n1 :");
                    LED = Console.ReadLine();
                    if (LED == "Q")
                    {
                        break;
                    }
                    chenillard.Led1 = LED;
                    Console.WriteLine("LED n2 :");
                    LED = Console.ReadLine();
                    if (LED == "Q")
                    {
                        break;
                    }
                    chenillard.Led2 = LED;
                    Console.WriteLine("LED n3 :");
                    LED             = Console.ReadLine();
                    chenillard.Led3 = LED;
                    if (LED == "Q")
                    {
                        break;
                    }
                    Console.WriteLine("LED n4 :");
                    LED             = Console.ReadLine();
                    chenillard.Led4 = LED;
                    if (LED == "Q")
                    {
                        break;
                    }

                    chenillard.changeOrder();
                    break;

                case "Q":
                    Console.WriteLine("Exiting....");
                    loopContinue = false;
                    break;
                }
            }

            Console.WriteLine("End... Press a Key to disconnect...");

            Console.ReadLine();

            Client.Disconnect();

            Console.WriteLine("Disconnected !");

            Console.ReadLine();
        }