Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var canon = new CanonPrinter("Canon", "1454");
            var epson = new EpsonPrinter("Epson", "1231");

            var manager = new PrinterManager();

            canon.Register(manager);
            epson.Register(manager);
            manager.SimulateNewPrint("Start");

            Console.WriteLine("Select your choice:");
            Console.WriteLine("1:Add new printer");
            Console.WriteLine("2:Print on Canon");
            Console.WriteLine("3:Print on Epson");

            var key = Console.ReadKey();

            if (key.Key == ConsoleKey.D1)
            {
                CreatePrinter();
            }

            if (key.Key == ConsoleKey.D2)
            {
                Print(canon);
            }

            if (key.Key == ConsoleKey.D3)
            {
                Print(epson);
            }

            while (true)
            {
                // waiting
            }
        }