Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var coreController = new CoreConsoleController();
            ////helper.ReplaceConsoleColor(ConsoleColor.DarkCyan, Color.Salmon);

            //controller.ReplaceConsoleColors(
            //    new Tuple<ConsoleColor, Color>(ConsoleColor.DarkCyan, Color.Chocolate),
            //    new Tuple<ConsoleColor, Color>(ConsoleColor.Blue, Color.DodgerBlue),
            //    new Tuple<ConsoleColor, Color>(ConsoleColor.Yellow, Color.Gold),
            //    new Tuple<ConsoleColor, Color>(ConsoleColor.DarkBlue, Color.MidnightBlue));

            IConsole console = new CoreConsole(coreController);

            ConsoleOperations ops = new ConsoleOperations(console);

            SplitterTest(console);
            PrintColorsMessages(console);
            PrintAllNamedColors(coreController, console);
            PrintFrames(ops, console);
            PrintTables(console);

            SimulateConsole(console);

            Console.WriteLine("Holding console window open. Press ENTER to quit for good.");
            console.ReadLine();
        }
Ejemplo n.º 2
0
        private static void PrintAllNamedColors(CoreConsoleController controller, IConsole console)
        {
            var props =
                typeof(Color).GetProperties(BindingFlags.Static | BindingFlags.Public)
                .Where(p => p.PropertyType == typeof(Color));

            foreach (var propertyInfo in props)
            {
                Color        c  = (Color)propertyInfo.GetValue(null);
                ConsoleColor cc = controller.CloseColorFinder.FindClosestColor(c);
                Console.ForegroundColor = cc;
                Console.WriteLine("{0,-25} {1,-18} #{2,-8:X}", propertyInfo.Name, Enum.GetName(typeof(ConsoleColor), cc),
                                  c.ToArgb());
            }

            Console.ReadLine();
            console.Clear();
        }