Exemple #1
0
        public void Activate()
        {
            if (IsRootNode)
            {
                return;
            }

            ParentScreen.ActivateChildScreen(this);
        }
Exemple #2
0
        public void ActivateChildScreen(IScreen screen)
        {
            var child = screen as Screen;
            var args  = new ScreenChangingEventArgs();

            child._screenChangingEvent.OnNext(args);


            if (args.IsHandled && args.IsCanceled)
            {
                return;
            }

            if (screen == null)
            {
                Debug.WriteLine("ActivateChildScreen with null");
                return;
            }
            if (!Contains(screen))
            {
                throw new ArgumentException("cannot activate screen, because the screen %0 doesn't contains screen %1");
            }


            if (_isMutual)
            {
                foreach (var childNode in ChildNodes)
                {
                    if (childNode == screen)
                    {
                        continue;
                    }

                    childNode.IsActive = false;
//                    _onExitEvent.OnNext(this);
                }

                ActiveIndex = screen.Index;
            }

            screen.IsActive = true;

//            _onEnterEvent.OnNext(this);
            if (IsRootNode)
            {
            }
            else
            {
                ParentScreen.ActivateChildScreen(this);
            }


//            if (ActiveChanged != null)
//                ActiveChanged(this);

            _activeChangedEvent.OnNext(this);
        }