示例#1
0
        static void Main(string[] args)
        {
            ColourPrinter ob1 = new ColourPrinter();
            PhotoPrinter  ob2 = new PhotoPrinter();

            ob1.Print("Hello");
            ob1.Print("Hello", ConsoleColor.Red);
            ob2.Print("Hello");
            ob2.Print("Hello", "Family");
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            Photo photo = new Photo {
                PhotoData = "photo string"
            };
            Printer       printer       = new Printer();
            ColourPrinter colourPrinter = new ColourPrinter();
            PhotoPrinter  photoPrinter  = new PhotoPrinter();


            printer.Print("Regular printer prints string.\n");
            colourPrinter.Print("Colour printer prints string.\n");
            photoPrinter.Print("Photo printer prints string.\n");
            colourPrinter.Print($"Colour printer prints string with selected {(ConsoleColor)12} colour.\n", 12);
            photoPrinter.Print(photo);

            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            var printer = new Printer();

            printer.Print("regular printer printing a message");
            var colourPrinter = new ColourPrinter();

            colourPrinter.Print("colour printer printing a message in red", ConsoleColor.Red);
            printer.Print("regular printer printing a message again");
            colourPrinter.Print("message without colour");
            colourPrinter.Print("colour printer printing a message in green", ConsoleColor.DarkGreen);
            var photoPrinter = new PhotoPrinter();

            photoPrinter.Print("message without photo");
            photoPrinter.Print(Image.FromFile("maidukov1.jpg"));

            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            var printer = new Printer("value");

            printer.Print(printer.PrintStream);

            var colourprinter = new ColourPrinter("ColorValue");

            colourprinter.Print(colourprinter.PrintStream);
            colourprinter.Print(colourprinter.PrintStream, ConsoleColor.Green);

            var photoprinter = new PhotoPrinter("PhotoValue");

            photoprinter.Print(photoprinter.PrintStream);
            var photo = new Photo();

            photo.makePhoto();
            photoprinter.Print(photo.picture, ConsoleColor.DarkYellow);

            Console.ReadLine();
        }