示例#1
0
        static void ColorSettings()
        {
            while (true)
            {
                Console.WriteLine("Color settings.");
                Console.Write("1. Change text color\n2. Change background color\n3. Back\n-> ");
                var key       = Console.ReadKey().KeyChar;
                var bgColor   = Console.BackgroundColor;
                var textColor = Console.ForegroundColor;
                Console.Clear();
                switch (key)
                {
                case '1':
                    Console.ForegroundColor = ChangedColor();
                    Console.Clear();
                    break;

                case '2':
                    Console.BackgroundColor = ChangedColor();
                    Console.Clear();
                    break;

                case '3': return;

                default:
                    Console.WriteLine("Invalid menu number. Try again");
                    break;
                }
                if (Console.BackgroundColor == Console.ForegroundColor)
                {
                    Console.BackgroundColor = bgColor;
                    Console.ForegroundColor = textColor;
                    throw new Exception("Error: text color and background color can't be equal");
                }
                var settings = new Settings((int)Console.ForegroundColor, (int)Console.BackgroundColor);
                SettingsController.SaveSettings(settings);
            }
        }
        static void Main(string[] args)
        {
            SettingsController.LoadSettings();
            Console.Clear();
            string[] arr =
            {
                "Project_1. Shape drawing by Andrey Basystyi.",
                "This program can draw shapes with some customization.",
                "Enjoy"
            };

            /*foreach (var i in arr)
             * {
             *  foreach (var j in i)
             *  {
             *      Console.Write(j);
             *      Thread.Sleep(25);
             *  }
             *  Thread.Sleep(1500);
             *  Console.Clear();
             * }*/
            MenuController.Start();
        }