示例#1
0
        public Menu <T> AddSpacer()
        {
            MenuOption <T> newOption = new MenuOption <T>()
            {
                IsSpace    = true,
                Selectable = false
            };

            this.Options.AddLast(newOption);
            return(this);
        }
示例#2
0
        public Menu <T> AddItem(T item)
        {
            MenuOption <T> newOption = new MenuOption <T>(item);

            this.Options.AddLast(newOption);

            if (this.Options.Count == 1)
            {
                this.CurrentOption = Options.First;
            }
            return(this);
        }
示例#3
0
        public void DrawMenu()
        {
            LinkedList <MenuOption <T> > .Enumerator e = this.Options.GetEnumerator();
            while (e.MoveNext())
            {
                MenuOption <T> currentOption = e.Current;

                if (currentOption.IsSpace)
                {
                    Console.WriteLine();
                }
                else
                {
                    OptionFormatter.Invoke(currentOption.Item);
                }
            }

            Console.WriteLine();
            Console.WriteLine();

            RedrawCurrentOption();

            DoMenuLoop();
        }