Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            BlackAndWhitePrinter bawPrinter = new BlackAndWhitePrinter();
            Secretary            eva        = new Secretary(bawPrinter);

            eva.Print("Secretary's bill");

            Console.WriteLine();

            ColourPrinter cPrinter    = new ColourPrinter();
            Director      herrSchulte = new Director(cPrinter);

            herrSchulte.Print("Director's order");

            Console.WriteLine();

            MatrixPrinter mPrinter = new MatrixPrinter();
            Trainee       kevin    = new Trainee(mPrinter);

            kevin.Print("Trainee's project");

            Console.WriteLine();

            PDFPrinter pdfPrinter = new PDFPrinter();
            Developer  heiko      = new Developer(pdfPrinter);

            heiko.Print("Developer's source code");

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public BlackAndWhitePrintCommand(BlackAndWhitePrinter printer)
 {
     this._Printer = printer;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            #region EMPLOYEES

            Secretary eva         = new Secretary();
            Director  herrSchulte = new Director();
            Developer heiko       = new Developer();
            Trainee   kevin       = new Trainee();

            #endregion

            #region PRINTER

            BlackAndWhitePrinter bwPrinter  = new BlackAndWhitePrinter();
            ColourPrinter        cPrinter   = new ColourPrinter();
            MatrixPrinter        mPrinter   = new MatrixPrinter();
            PDFPrinter           pdfPrinter = new PDFPrinter();

            #endregion

            #region PRINT COMMANDS

            IPrintCommand blackAndWhitePrintCommand = new BlackAndWhitePrintCommand(bwPrinter);
            IPrintCommand colourPrintCommand        = new ColourPrintCommand(cPrinter);
            IPrintCommand matrixPrintCommand        = new MatrixPrintCommand(mPrinter);
            IPrintCommand pdfPrintCommand           = new PDFPrintCommand(pdfPrinter);

            PrintQueueCommand printQueueCommand = new PrintQueueCommand();
            printQueueCommand.AddCommand(blackAndWhitePrintCommand);
            printQueueCommand.AddCommand(colourPrintCommand);
            printQueueCommand.AddCommand(matrixPrintCommand);
            printQueueCommand.AddCommand(pdfPrintCommand);

            IPrintCommand directorPrintCommand = new DirectorPrintCommand(eva);

            #endregion

            eva.PrintCommand = blackAndWhitePrintCommand;
            eva.Print("Eva's bill");

            Console.WriteLine();

            eva.PrintCommand = colourPrintCommand;
            eva.Print("Eva's bill");

            Console.WriteLine();

            heiko.PrintCommand = pdfPrintCommand;
            heiko.Print("Heiko's source code");

            Console.WriteLine();

            heiko.PrintCommand = matrixPrintCommand;
            heiko.Print("Heiko's source code");

            Console.WriteLine();

            kevin.PrintCommand = printQueueCommand;
            kevin.Print("Kevin's print queue.");

            Console.WriteLine();

            herrSchulte.PrintCommand = directorPrintCommand;
            herrSchulte.Print("Order 666");

            Console.ReadKey();
        }
Ejemplo n.º 4
0
 public Secretary(BlackAndWhitePrinter printer)
 {
     this._Printer = printer;
 }