Пример #1
0
        private static void AddToBackStack(BaseView view)
        {
            //remove if presented
            while (BackStack.Remove(view))
            {
                ;
            }

            //add to end
            if (BackStack.Count == 0)
            {
                BackStack.AddLast(view);
                return;
            }

            //find by priority
            var node = BackStack.Last;

            while (node != null && node.Value.BackPrority > view.BackPrority)
            {
                node = node.Previous;
            }

            if (node == null)
            {
                BackStack.AddFirst(view);
                return;
            }
            else
            {
                BackStack.AddAfter(node, view);
            }
        }