Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int consoleColorCount = ConsoleColor.GetNames(typeof(ConsoleColor)).Length;
- uint darkCyanNumber = 3;
- uint whiteNumber = 15;
- string userName = "";
- string userPassword = "";
- string chooseMenuInput;
- uint chooseColorInput;
- bool isRun = true;
- bool isChangeColor;
- while (isRun)
- {
- Console.WriteLine("\nWhat do you want to do : ");
- Console.WriteLine("CreateUser\n" +
- "ChangePassword\n" +
- "GetName\n" +
- "ChangeTextColor\n" +
- "ChangeBackgroundColor\n" +
- "Esc");
- chooseMenuInput = Console.ReadLine();
- switch (chooseMenuInput)
- {
- case "CreateUser":
- Console.WriteLine("\nPlease input name of user : ");
- userName = Console.ReadLine();
- Console.WriteLine("Please input password of user : ");
- userPassword = Console.ReadLine();
- break;
- case "ChangePassword":
- if (String.IsNullOrEmpty(userPassword) == false)
- {
- Console.WriteLine("\nPlease input a new password : ");
- userPassword = Console.ReadLine();
- }
- else
- {
- Console.WriteLine("\nPlease CreateUser to ChangePassword.");
- }
- break;
- case "GetName":
- if (String.IsNullOrEmpty(userName) == false)
- {
- Console.WriteLine("\nUser name is : " + userName);
- }
- else
- {
- Console.WriteLine("\nPlease CreateUser to GetName.");
- }
- break;
- case "ChangeTextColor":
- isChangeColor = true;
- while (isChangeColor)
- {
- Console.WriteLine("\nChoose colors of text : ");
- Console.WriteLine("0. Black\n" +
- "1.DarkBlue\n" +
- "2.DarkGreen\n" +
- "4.DarkRed\n" +
- "5.DarkMagenta\n" +
- "6.DarkYellow\n" +
- "7.Gray\n" +
- "8.DarkGray\n" +
- "9.Blue\n" +
- "10.Green\n" +
- "11.Cyan\n" +
- "12.Red\n" +
- "13.Magenta\n" +
- "14.Yellow\n" +
- "15.White");
- chooseColorInput = Convert.ToUInt32(Console.ReadLine());
- if (chooseColorInput < consoleColorCount && chooseColorInput != darkCyanNumber)
- {
- Console.ForegroundColor = (ConsoleColor) chooseColorInput;
- isChangeColor = false;
- }
- else
- {
- Console.WriteLine("Please input number of color in range.");
- }
- }
- break;
- case "ChangeBackgroundColor":
- Console.WriteLine();
- isChangeColor = true;
- while (isChangeColor)
- {
- Console.WriteLine("\nChoose colors of text : ");
- Console.WriteLine("0. Black\n" +
- "1.DarkBlue\n" +
- "2.DarkGreen\n" +
- "3.DarkCyan\n" +
- "4.DarkRed\n" +
- "5.DarkMagenta\n" +
- "6.DarkYellow\n" +
- "7.Gray\n" +
- "8.DarkGray\n" +
- "9.Blue\n" +
- "10.Green\n" +
- "11.Cyan\n" +
- "12.Red\n" +
- "13.Magenta\n" +
- "14.Yellow");
- chooseColorInput = Convert.ToUInt32(Console.ReadLine());
- if (chooseColorInput < consoleColorCount && chooseColorInput != whiteNumber)
- {
- Console.BackgroundColor = (ConsoleColor) chooseColorInput;
- isChangeColor = false;
- }
- else
- {
- Console.WriteLine("Please input number of color in range.");
- }
- }
- break;
- case "Esc":
- isRun = false;
- break;
- default:
- Console.WriteLine("\nPlease input name of command correctly.");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement