public void ShowMenu() { int userInput = 0; showMenu = true; int index = 0; string backOrExit = null; if (this is MainMenu == true) { backOrExit = "Exit"; } else { backOrExit = "Back"; } while (showMenu) { Console.Clear(); Console.WriteLine("You are in Menu named {0} and its level is {1}", ItemText, m_Level); Console.WriteLine("{0}. {1}", index++, backOrExit); foreach (MenuItem menuItem in m_MenuItems) { Console.WriteLine("{0}. {1}", index++, menuItem.ItemText); } userInput = GetUserInputAndValidate(); if (userInput == k_ExitOrBackNumber) { showMenu = false; if (this is MainMenu == false) { PreviousMenu.Run(); } } else { m_MenuItems[userInput - 1].Run(); } } }
public override void Run() { m_MenuItemaction.Excecute(); PreviousMenu.Run(); }
public override void Run() { Console.Clear(); this.OnClicked(); PreviousMenu.Run(); }