static void Main(string[] args) { FontState fontState = FontState.None; while (true) { Console.WriteLine($"Параметры надписи: {fontState.ToString()}"); Console.WriteLine("Введите:"); for (int i = 1; i <= 3; i++) { Console.WriteLine($"\t{i}: {GetFont(i)}"); } if (Int32.TryParse(Console.ReadLine(), out int option)) { if (option > 3 || option < 1) { break; } fontState = fontState ^ GetFont(option); } else { break; } } }
static void Main(string[] args) { FontState fontType = 0; string input; int font; do { Console.WriteLine("Font parameters: {0}", fontType.ToString()); Console.WriteLine("Input:\n" + " 1: bold\n" + " 2: italic\n" + " 3: underline"); //Console.WriteLine(" exit: for exit"); input = Console.ReadLine(); if ((int.TryParse(input, out font)) && (font > 0) && (font < 4)) { switch (font) { case 1: fontType ^= FontState.Bold; break; case 2: fontType ^= FontState.Italic; break; case 3: fontType ^= FontState.Underline; break; } } else { if (input.Equals("exit")) { break; } else { Console.WriteLine("Incorrect input"); } } } while (!(input.Equals("exit"))); }