Example #1
0
        public IScreen PopScreen()
        {
            ScreenContext activeContext = null;

            if (_screenStack.Count > 0)
            {
                activeContext = _screenStack.Pop();

                if (_contentLoaded == true)
                {
                    activeContext.Screen.UnloadContent();
                }
            }

            return(activeContext != null ? activeContext.Screen : null);
        }
Example #2
0
        public void PushScreen(IScreen screen)
        {
            ScreenContext activeContext = null;

            if (_screenStack.Count > 0)
            {
                activeContext = _screenStack.Peek();
            }

            var underlayingScreens = new List <IScreen>();

            if (screen.IsPopup == true && activeContext != null)
            {
                underlayingScreens.AddRange(activeContext.UnderlayingScreens);
                underlayingScreens.Add(activeContext.Screen);
            }

            if (_contentLoaded)
            {
                screen.LoadContent();
            }

            _screenStack.Push(new ScreenContext(screen, underlayingScreens));
        }