Esempio n. 1
0
        private static void CommunicationConsole()
        {
            Concentrateur concentrateur = new Concentrateur("DEPARTEMENT 420");

            string commande = "";

            do
            {
                commande = GetCommande();
                Console.WriteLine(concentrateur.ExecuterCommande(commande));
            }while (commande != "Q");
        }
Esempio n. 2
0
        private static void VerificationsConsole()
        {
            string[] commandes =
            {
                "C",                        // Commande invalide (Exception)
                "",                         // Commande invalide (Exception)
                "CZ",                       // Parametre manquant (Exception)
                "CL Z1",                    // Parametre manquant (Exception)
                "CL Z1 L1",                 // Zone inexistante (Exception)
                "CZ Z1",                    // Creation d'une zone Z1
                "CL Z1",                    // Parametre manquant (Exception)
                "CZ Z1",                    // Creation d'une zone Z1 (Exception)
                "CZ Z2",                    // Creation d'une zone Z2
                "SZ Z2",                    // Suppression d'une zone Z2
                "SZ Z2",                    // Suppression d'une zone Z2 (Exception)
                "AZ Z2",                    // Operation sur une zone supprimee Z2 (Exception)
                "AZ Z1",                    // Activer une zone sans appareil
            };


            int nb = 1;

            Console.WriteLine("\nVERIFICATIONS DE LA CONSOLE");
            Console.WriteLine("---------------------------");

            Console.WriteLine("A - Creation CONSOLE");
            Concentrateur concentrateur = new Concentrateur("DEPARTEMENT 420");

            foreach (string commande in commandes)
            {
                try
                {
                    Console.WriteLine("A." + nb++ + " >>>  " + commande);
                    Console.WriteLine(concentrateur.ExecuterCommande(commande));
                }
                catch (C420Exception c420e)
                {
                    Console.WriteLine(c420e.Message);
                }
                Console.ReadKey();
            }

            Console.WriteLine("-------------------------");
            Console.WriteLine("FIN DE LA VERIFICATION");
        }