Example #1
0
        //Assumes that I want to close only top view? is it correct?
        public void Close(UiViewModel ViewModel)
        {
            if (Stack.Count == 0)
            {
                Debug.LogErrorFormat("Trying to close Viev: {0}, But Stack is empty", ViewModel);
                return;
            }

            if (Stack.Peek() != ViewModel)
            {
                Debug.LogErrorFormat("Trying to close View ({0}), but it isn't at the top of the Stack", ViewModel);
                return;
            }

            CloseTopView();
        }
Example #2
0
        public void AddViewModel(UiViewModel ViewModel)
        {
            if (Stack.Count > 0)
            {
                //Hide other views on Open
                if (ViewModel.IView.HideAllOtherViews)
                {
                    foreach (var view in Stack)
                    {
                        view.Canvas.enabled = false;
                    }
                }

                //Setup Canvas Sorting Order
                var TopCanvas      = ViewModel.Canvas;
                var PreviousCanvas = Stack.Peek().Canvas;
                TopCanvas.sortingOrder = PreviousCanvas.sortingOrder + 1;
            }

            Stack.Push(ViewModel);
        }