Exemplo n.º 1
0
 private static void Add(PrinterFactory factory)
 {
     try
     {
         printerManager.Add(factory.CreatePrinter());
     }
     catch (Exception e)
     {
         System.Console.WriteLine(e);
         System.Console.ReadKey();
     }
 }
Exemplo n.º 2
0
        public void Add()
        {
            Console.WriteLine("\nEnter printer name");
            string name = Console.ReadLine();

            Console.WriteLine("Enter printer model");
            string model = Console.ReadLine();

            var printer = PrinterFactory.CreatePrinter(name, model);

            if (!this.repository.Contains(printer))
            {
                this.repository.Save(printer);
                Console.WriteLine("Printer added.");
            }
            else
            {
                Console.WriteLine("\nPrinter already exists.");
            }
        }
Exemplo n.º 3
0
 public void RegisterPrinterType(PrinterType printerType)
 {
     // Incase there are unprinted labels when changing printers.
     Labels.Clear();
     this.printer = PrinterFactory.CreatePrinter(printerType);
 }