Example #1
0
 public Menu(MenuTitle title, List <MenuLine> lines, List <MenuSelection> selections, string prompt)
 {
     Title          = title;
     MenuLines      = lines;
     MenuSelections = selections;
     Prompt         = prompt;
 }
Example #2
0
 //Constructors
 public Menu()
 {
     Title          = new MenuTitle();
     MenuLines      = new List <MenuLine>();
     MenuSelections = new List <MenuSelection>();
     Prompt         = string.Empty;
 }
Example #3
0
        /// <summary>
        /// Draws the passed Menu to the screen.
        /// </summary>
        /// <param name="menu">The Menu to draw to the screen</param>
        public static void DrawMenu(Menu menu, ref List <string> errors, ref List <string> successMessages)
        {
            Console.Clear();
            //Write out any errors before drawing the Menu
            if (errors != null && errors.Count > 0)
            {
                foreach (string error in errors)
                {
                    WriteError(error);
                }
                errors.Clear();
            }
            //Write out any success messages before drawing the Menu
            if (successMessages != null && successMessages.Count > 0)
            {
                foreach (string success in successMessages)
                {
                    WriteSuccess(success);
                }
                successMessages.Clear();
            }
            DrawDivider();
            MenuTitle title = menu.GetTitle();

            if (title.Text != "" && title.Text != null)
            {
                DrawTitle(title);
                DrawDivider();
            }
            List <MenuLine> lines = menu.GetLines();

            if (lines.Count > 0)
            {
                DrawMenuLines(lines);
                DrawDivider();
            }
            List <MenuSelection> selections = menu.GetMenuSelections();

            if (selections.Count > 0)
            {
                DrawSelections(selections);
                DrawDivider();
            }
            //DrawPrompt(menu.GetPrompt());
        }
Example #4
0
        public void SetTitle(string title, ConsoleColor colour = ConsoleColor.White)
        {
            MenuTitle newTitle = new MenuTitle(title, (MenuColours)colour);

            Title = newTitle;
        }
Example #5
0
        public void SetTitle(string title, MenuColours colour = MenuColours.DEFAULT)
        {
            MenuTitle newTitle = new MenuTitle(title, colour);

            Title = newTitle;
        }
Example #6
0
 public void SetTitle(MenuTitle title)
 {
     Title = title;
 }
Example #7
0
 /// <summary>
 /// Draws the passed MenuTitle to the screen centered.
 /// </summary>
 /// <param name="title">The MenuTitle to draw</param>
 private static void DrawTitle(MenuTitle title)
 {
     WriteLine(title.Text, title.Colour, true);
 }