private static void Add(PrinterFactory factory) { try { printerManager.Add(factory.CreatePrinter()); } catch (Exception e) { System.Console.WriteLine(e); System.Console.ReadKey(); } }
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."); } }
public void RegisterPrinterType(PrinterType printerType) { // Incase there are unprinted labels when changing printers. Labels.Clear(); this.printer = PrinterFactory.CreatePrinter(printerType); }