Пример #1
0
        internal AppStateManager CreateSubstateManager(AppState state, AppStateManager parentStateManager)
        {
            Debug.Assert(state != null);
            Debug.Assert(parentStateManager != null);
            ThrowIfDisposed();

            return(new AppStateManager(state, parentStateManager));
        }
Пример #2
0
        internal AppStateManager(AppState parentState, AppStateManager parentStateManager)
        {
            Debug.Assert(parentState != null);
            Debug.Assert(parentStateManager != null);

            _console = parentStateManager._console;
            _synchronizationContext = parentStateManager._synchronizationContext;
            _controllerFactory      = parentStateManager._controllerFactory;
            _viewManager            = parentStateManager._viewManager;
            _parentState            = parentState;
            _parentStateManager     = parentStateManager;
            _serviceProvider        = parentStateManager._serviceProvider;
        }
Пример #3
0
        internal AppState(AppStateManager parentStateManager, IAppState owner, Type controllerType, object args)
        {
            Debug.Assert(parentStateManager != null);
            Debug.Assert(controllerType != null);

            _parentStateManager = parentStateManager;
            _parentState        = parentStateManager.ParentState;
            _ownerState         = owner;
            _stateArgs          = args;
            _eventArgs          = new AppStateEventArgs(this);
            _console            = parentStateManager.TraceSource;
            _stack = parentStateManager.StatesEx;

            if (Attribute.GetCustomAttribute(controllerType, typeof(AppStateControllerAttribute)) is AppStateControllerAttribute paramsAttr)
            {
                if (string.IsNullOrEmpty(paramsAttr.Name))
                {
                    _name = GetStateNameSimple(controllerType);
                }
                else
                {
                    _name = paramsAttr.Name;
                }

                _flags = paramsAttr.Flags;
                _layer = paramsAttr.Layer;
            }
            else
            {
                _name = GetStateNameSimple(controllerType);
            }

            // Force AppStateFlags.Popup flag for child states.
            if (_parentState != null)
            {
                _flags |= AppStateFlags.Popup;
            }

            _fullName         = _parentState?.FullName + '.' + _name ?? _name;
            _controller       = parentStateManager.CreateStateController(this, controllerType);
            _controllerEvents = _controller as IAppStateEvents;
        }