public void GoBack() { if (m_CurrentItem.Ancestor != null) { m_CurrentItem.Ancestor.MenuScreen(); m_CurrentItem = m_CurrentItem.Ancestor; } else { Console.WriteLine(@"We are sorry to hear about that. Hope to see you again"); Environment.Exit(0); } }
private void EnfoldOrTrigger() { SubMenu subList = m_CurrentItem as SubMenu; if (subList != null) { m_CurrentItem = subList; subList.MenuScreen(); } else { ActionItem trigger = m_CurrentItem as ActionItem; if (trigger != null) { m_CurrentItem = trigger; trigger.Action.Invoke(trigger.Title); Continue(); GoBack(); } } }
public void Navigate() { int userChoice; MenuScreen(); do { ChooseYourOption(out userChoice); if (userChoice != 0) { m_CurrentItem = (m_CurrentItem as MainMenu).Menu.ElementAt(userChoice - 1); EnfoldOrTrigger(); } else { GoBack(); } } while (true); }
public void RemoveMenuUnit(MenuUnit i_UnitToRemove) { r_Menu.Remove(i_UnitToRemove); }
public void AddMenuUnit(MenuUnit i_UnitToAdd) { r_Menu.Add(i_UnitToAdd); }
public MainMenu(MainMenu i_Father, string i_Title) : base(i_Father, i_Title) { r_Menu = new List <MenuUnit>(); m_CurrentItem = this; }