Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace C_Ijun
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const string CommandClearWindow = "ClearWindow";
- const string CommandTimeInfo = "Today is...";
- const string CommandChangeColorText = "ChangeColorConsoleText";
- const string CommandChangeColorBckg = "ChangeColorConsoleBackground";
- const string CommandExit = "Exit";
- bool isWork = true;
- string userChoice;
- while (isWork)
- {
- Console.WriteLine("Консольное меню.");
- Console.WriteLine("Выбрать действие:");
- Console.WriteLine($"{CommandClearWindow} - Очистить экран.");
- Console.WriteLine($"{CommandTimeInfo} - Вывести день недели.");
- Console.WriteLine($"{CommandChangeColorText} - Изменить расветку текста консоли.");
- Console.WriteLine($"{CommandChangeColorBckg} - Изменить расветку фона консоли.");
- Console.WriteLine($"{CommandExit} - Выход.");
- userChoice = Console.ReadLine();
- switch (userChoice)
- {
- case CommandClearWindow:
- Console.Clear();
- break;
- case CommandTimeInfo:
- Console.WriteLine(DateTime.Now);
- break;
- case CommandChangeColorText:
- if (Console.ForegroundColor == ConsoleColor.Blue)
- {
- Console.ForegroundColor = ConsoleColor.Black;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Blue;
- }
- break;
- case CommandChangeColorBckg:
- Console.Clear();
- if (Console.BackgroundColor == ConsoleColor.Blue)
- {
- Console.BackgroundColor = ConsoleColor.White;
- }
- else
- {
- Console.BackgroundColor = ConsoleColor.Blue;
- }
- break;
- case CommandExit:
- Console.WriteLine("Это конец...");
- isWork = false;
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement