public void Show()
        {
            m_CurrentMenuItem = r_RootMenuItem;
            while (true)
            {
                Console.WriteLine(buildMenu(m_CurrentMenuItem));
                int userInput = getValidInputFromUser(m_CurrentMenuItem);
                if (userInput == 0)
                {
                    if (m_CurrentMenuItem.Level == 0)
                    {
                        Console.Out.WriteLine("BYEEEEEEEEEEEE");
                        break;
                    }

                    m_CurrentMenuItem = m_CurrentMenuItem.ParentMenuItem;
                    continue;
                }

                MenuItem menuItemPicked = m_CurrentMenuItem.SubMenuItems[userInput - 1];
                menuItemPicked.OnChosen();

                Console.Clear();
            }
        }
Exemplo n.º 2
0
        private void handleUserChoice(int i_UserInput)
        {
            MenuItem chosenMenuItem = m_MenuItems[i_UserInput - 1];

            if (chosenMenuItem.MenuItems == null)
            {
                chosenMenuItem.OnChosen(this);
            }
            else
            {
                chosenMenuItem.show();
            }
        }