static void Main(string[] args) { CanonPrinter canon = new CanonPrinter(); Console.Write("Canon printer: "); canon.Print(); HPPrinter hp = new HPPrinter(); Console.Write("HP printer: "); hp.Print(); Console.ReadLine(); }
private static IPrinter CreatePrinter() { Console.WriteLine("Choose Printer to use\n 1. HP \n 2. Canon"); string choice = Console.ReadLine(); if (choice == "1") { HPPrinter p = new HPPrinter(); return(p); } else { CanonPrinter p = new CanonPrinter(); return(p); } }
public ContentResult Index() { String stringTemp = ""; String PrintName = "HP"; if (PrintName == "HP") { IPrinter concretePrinter = new HPPrinter(); stringTemp = concretePrinter.PrinterName() + ";" + concretePrinter.PrintPreview() + ";" + concretePrinter.Print(); } else if (PrintName == "Epson") { IPrinter concretePrinter = new EpsonPrinter(); stringTemp = concretePrinter.PrinterName() + ";" + concretePrinter.PrintPreview() + ";" + concretePrinter.Print(); } String stirngNow = (new Printer()).Notation() + ";" + stringTemp; return(this.Content(stirngNow)); }