Пример #1
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.Write("Введите строку: ");
            string strToPrint = Console.ReadLine();

            Console.WriteLine("Выберите операцию:\n1. В консоль\n2. В файл\n3. В картинку");
            string operation = Console.ReadLine();

            IPrinter newPrinter;

            switch (operation)
            {
            case "1":
                newPrinter = new ConsolePrinter(ConsoleColor.Magenta);
                newPrinter.Print(strToPrint);
                break;

            case "2":
                newPrinter = new FilePrinter("newFile");
                newPrinter.Print(strToPrint);
                break;

            case "3":
                newPrinter = new ImagePrinter("newImage", 30, 5, 5);
                newPrinter.Print(strToPrint);
                break;

            default:
                Console.WriteLine("Некорректная операция");
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.WriteLine("Insert the text to print");
            string text = Console.ReadLine();

            Console.WriteLine("Choose print type");
            Console.WriteLine("1 - Console");
            Console.WriteLine("2 - File");
            Console.WriteLine("3 - Image");
            string resultOfUserChoice = Console.ReadLine();

            switch (resultOfUserChoice)
            {
            case "1":
                // Console.WriteLine("You've chosen the printing into console");
                // ConsolePrinter consolePrinter = new ConsolePrinter();
                var printer = new ConsolePrinter(text, ConsoleColor.Blue);
                printer.Print();
                break;

            case "2":
                //Console.WriteLine("You've chosen the printing into file");
                var printer2 = new FilePrinter(text, "Test");
                printer2.Print();
                break;

            case "3":
                var printer3 = new ImagePrinter(text, "ImagePrinterExample");
                printer3.Print();
                break;
            }
        }
Пример #3
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.WriteLine("Введите текст ");
            string text = Console.ReadLine();

            Console.WriteLine("Choose print tupe : ");
            Console.WriteLine("1-console : ");
            Console.WriteLine("2-file : ");
            Console.WriteLine("3-picture : ");
            string type = Console.ReadLine();

            IPrinter printer = null;


            switch (type)
            {
            case "1":
                var printer1 = new ConsolePrinter(ConsoleColor.Blue);
                printer1.Print(text);
                break;

            case "2":
                var printer2 = new FilePrinter("test");
                printer2.Print(text);
                break;

            case "3":
                var printer3 = new BitmapPrinter("BitmapPrinerExample");
                printer3.Print(text);
                Console.WriteLine("You have choosen printing  into picture ");
                break;
            }
        }
Пример #4
0
        /// <summary>
        /// A.L2.P1/1. Создать консольное приложение, которое может выводить
        /// на печатать введенный текст  одним из трех способов:
        /// консоль, файл, картинка.
        /// </summary>
        public static void A_L2_P1_1()
        {
            Console.WriteLine("Inter text for conclusion:");
            var text = Console.ReadLine();

            Console.WriteLine(value: "Choos print type:");
            Console.WriteLine(value: "1-Console");
            Console.WriteLine(value: "2-File");
            Console.WriteLine(value: "3-Image");
            var      type = Console.ReadLine();
            IPrinter printer;

            switch (type)
            {
            case "1":
                printer = new ConsolePrinter(ConsoleColor.Blue);
                printer.Print(text);
                break;

            case "2":
                printer = new FilePrinter(fileName: "TEST");
                printer.Print(text);
                break;

            case "3":
                printer = new ImagePrinter(Color.DarkRed, Color.AliceBlue);
                printer.Print(text);
                break;

            default:
                break;
            }
        }
Пример #5
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();
            //}
        }
Пример #6
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;
            }
            }
        }