예제 #1
0
        //public methods
        public void Initialize()
        {
            if (!init)
            {
                nameLen  += options.OrderByDescending(o => o.Name.Length).First().Name.Length;
                valueLen += options.OrderByDescending(o => o.TextValue.Length).First().TextValue.Length;

                ConsoleTools.DrawBox(pos, new Vector2(nameLen + valueLen, options.Length + 2), borderStyle, borderColor);

                Console.SetCursorPosition(pos.X + 1, pos.Y + 1);
                Console.ForegroundColor = textColor;

                for (int i = -2; i < options.Length; i++)
                {
                    if (i == -2)
                    {
                        Console.WriteLine(title.ToUpper());
                    }
                    else if (i == -1)
                    {
                        Console.WriteLine("");
                    }
                    else
                    {
                        if (pointer == i)
                        {
                            Console.BackgroundColor = pointerColor;
                        }

                        Console.WriteLine(options[i].Name.PadRight(nameLen) + options[i].TextValue.PadRight(valueLen));

                        Console.BackgroundColor = ConsoleColor.Black;
                    }

                    Console.CursorLeft += pos.X + 1;
                }

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine();

                init = true;
            }
        }
예제 #2
0
        public void Initialize()
        {
            int width  = longest + indent + fieldLength + 4;
            int height = (3 * items.Length) + 1;

            ConsoleTools.DrawBox(pos, new Vector2(width, height), ConsoleTools.style12, ConsoleColor.White);

            //start writing
            Console.SetCursorPosition(pos.X + 1, pos.Y + 1);
            Console.WriteLine(title.ToUpper());
            Console.CursorLeft = pos.X + 1;

            for (int i = 1; i <= items.Length; i++)
            {
                ConsoleTools.DrawBox(new Vector2(pos.X + longest + indent, pos.Y + (3 * i) - 1), new Vector2(fieldLength + 2, 1),
                                     ConsoleTools.style11, ConsoleColor.White);

                Console.SetCursorPosition(pos.X + 1, pos.Y + (3 * i));
                Console.Write(items[i - 1] + ':');
            }

            //Console.SetCursorPosition(pos.X + longest + indent + 2, pos.Y + (i * 3));
            //where i = the item number
        }