public void Show() { Messages.dsiplayMenu(this); string userChoice = Console.ReadLine(); bool userWantsToGoBack = false; while (!userWantsToGoBack) { if (!(int.TryParse(userChoice, out int userChoiceAsInt) && ValidateUserInput.IsInputInRange(userChoiceAsInt, m_MenuItemList.Count))) { Messages.displayMessageAndContinue("The input is not one of the available option(s). Please try again"); Show(); } if (userChoiceAsInt == 0) { userWantsToGoBack = true; } else { m_MenuItemList[userChoiceAsInt - 1].MenuThatItemBelongsTo = this; m_MenuItemList[userChoiceAsInt - 1].ActionWhenChoose(); Console.ReadLine(); } } if (this is SubMenu) { m_ParentMenu.Show(); } else { Messages.endSequence(); } }
public virtual void Show() { Messages.dsiplayMenu(this); string userChoice = Console.ReadLine(); if (!(int.TryParse(userChoice, out int userChoiceAsInt) && ValidateUserInput.IsInputInRange(userChoiceAsInt, m_MenuItemList.Count))) { Messages.displayMessageAndContinue("The input is not one of the available option(s). Please try again"); Show(); }