Exemple #1
0
        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);
            }
        }
Exemple #2
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();
                }
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public void RemoveMenuUnit(MenuUnit i_UnitToRemove)
 {
     r_Menu.Remove(i_UnitToRemove);
 }
Exemple #5
0
 public void AddMenuUnit(MenuUnit i_UnitToAdd)
 {
     r_Menu.Add(i_UnitToAdd);
 }
Exemple #6
0
 public MainMenu(MainMenu i_Father, string i_Title) : base(i_Father, i_Title)
 {
     r_Menu        = new List <MenuUnit>();
     m_CurrentItem = this;
 }