/// <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"); string type = Console.ReadLine(); IPrinter printer = null; switch (type) { case "1": printer = new ConsolePrinter(ConsoleColor.Blue); break; case "2": printer = new FilePrinter("test"); break; case "3": printer = new ImagePrinter("bitmap"); break; } Console.WriteLine("Write text"); for (int i = 0; i < 5; i++) { var text = Console.ReadLine(); printer?.Print(text); } }
/// <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; } }
/// <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; } }
/// <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; } }
/// <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; } } }