Esempio n. 1
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.WriteLine(" Choose print type: ");
            Console.WriteLine("1 - Console");
            Console.WriteLine("2 - File");
            Console.WriteLine("3 - Image");
            Console.Write(">> ");
            var      type    = Console.ReadLine();
            IPrinter printer = null;

            switch (type)
            {
            case "1":
            {
                printer = new ConsolePrinter(ConsoleColor.DarkBlue);
                //printer.Print();
                //Console.WriteLine("You have chosen printing into console");
                break;
            }

            case "2":
            {
                printer = new FilePrinter("PrintingText");
                //printer.Print();
                //Console.WriteLine("You have chosen printing into file");
                break;
            }

            case "3":
            {
                printer = new BitmapPrinter("testImage");
                //printer.Print(Console);
                //Console.WriteLine("You have chosen printing into image");
                break;
            }
            }
            Console.WriteLine("Write text");
            for (int i = 0; i < 1; i++)
            {
                Console.Write(">> ");
                printer.Print(Console.ReadLine());
                //printer.Print();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
loop:
            Console.WriteLine("Введите текст: ");
            string text = Console.ReadLine();

            Console.WriteLine("Choose print type: ");
            Console.WriteLine("1 - Console");
            Console.WriteLine("2 - File");
            Console.WriteLine("3 - Image");
            string   type     = Console.ReadLine();
            IPrinter printer3 = null;

            switch (type)
            {
            case "1":
                Console.WriteLine("You have chosen printing into Console");
                var printer1 = new ConsolePrinter(text, ConsoleColor.Blue);
                printer1.Print(text);
                break;

            case "2":
                Console.WriteLine("You have chosen printing into File");
                var printer2 = new FilePrinter(text, "Test");
                printer2.Print(text);
                break;

            case "3":
                printer3 = new BitmapPrinter("File For Example");
                Console.WriteLine("You have chosen printing into Image");
                break;

            default:
                Console.WriteLine("Wrong input. Repeat, please."); goto loop;
                //break;
            }

            //Console.WriteLine("Write text:");

            //for (int i = 0; i < 5; i++)
            //{
            //    var textS = Console.ReadLine();
            //}
        }
Esempio n. 3
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.WriteLine("Введите строку");
            var text = Console.ReadLine();



            Console.WriteLine("Выберите метод вывода информации: \n 1 - Console \n 2 - File \n 3 -Image ");

            string choose = Console.ReadLine();

            IPrinter printer = null;

            switch (choose)
            {
            case "1":
            {
                Console.WriteLine(value: " Console ");
                printer = new ConsolePrinter(text, ConsoleColor.DarkRed);
                printer.Print();
                break;
            }

            case "2":
            {
                Console.WriteLine(value: " File ");
                printer = new FilePrinter(text, "practice");
                printer.Print();
                break;
            }

            case "3":
            {
                Console.WriteLine(value: " Image ");
                printer = new ImagePrinter(text, "practice");
                printer.Print();
                break;
            }
            }
        }