コード例 #1
0
        static void Main(string[] args)
        {
            //Tratando de generar un formulario
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.

            //c.Llamadas.Add(l1);
            c += l1;
            Console.WriteLine(c.ToString());

            //c.Llamadas.Add(l2);
            c += l2;
            Console.WriteLine(c.ToString());

            //c.Llamadas.Add(l3);
            try
            {
                c += l3;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaException e)
            {
                Console.WriteLine(e.Message + e.NombreClase + e.NombreMetodo);
            }


            //c.Llamadas.Add(l4);
            try
            {
                c += l4;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaException e)
            {
                Console.WriteLine(e.Message + e.NombreClase + e.NombreMetodo);
            }


            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());

            Console.WriteLine("\nPresione una tecla para abrir el formulario principal\n");
            //Console.ReadKey();

            //Creando un formulario
            Application.Run(new FormCentral(c));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            try
            {
                c += l1;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaExcepcion error)
            {
                Console.WriteLine(error.Message);
            }

            try
            {
                c += l2;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaExcepcion error)
            {
                Console.WriteLine(error.Message);
            }

            try
            {
                c += l3;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaExcepcion error)
            {
                Console.WriteLine(error.Message);
            }

            try
            {
                c += l4;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaExcepcion error)
            {
                Console.WriteLine(error.Message);
            }
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(l2, Franja.Franja_3);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            try
            {
                c = c + l4;
                //  Console.WriteLine(c.Mostrar());
                c = c + l3;
                //  Console.WriteLine(c.Mostrar());
                c = c + l2;
                //  Console.WriteLine(c.Mostrar());
                c = c + l1;
            }
            catch (CentralitaException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception general)
            {
                Console.WriteLine(general.Message);
            }
            //Console.WriteLine(c.Mostrar());
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
        }