/// <summary>
        /// Handler called every time a state is moved in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnStateMoved(WriteableMoveNodeOperation operation)
        {
            base.OnStateMoved(operation);

            IFocusPlaceholderNodeState State = ((FocusMoveNodeOperation)operation).State;

            Debug.Assert(State != null);
            Debug.Assert(StateViewTable.ContainsKey(State));
        }
        /// <summary>
        /// Handler called every time a block state is inserted in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnBlockStateInserted(IWriteableInsertBlockOperation operation)
        {
            base.OnBlockStateInserted(operation);

            IFocusBlockState BlockState = ((IFocusInsertBlockOperation)operation).BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(BlockStateViewTable.ContainsKey(BlockState));

            Debug.Assert(StateViewTable.ContainsKey(BlockState.PatternState));
            Debug.Assert(StateViewTable.ContainsKey(BlockState.SourceState));

            Debug.Assert(BlockState.StateList.Count == 1);

            IFocusPlaceholderNodeState ChildState = ((IFocusInsertBlockOperation)operation).ChildState;

            Debug.Assert(ChildState == BlockState.StateList[0]);
            Debug.Assert(ChildState.ParentIndex == ((IFocusInsertBlockOperation)operation).BrowsingIndex);
            Debug.Assert(StateViewTable.ContainsKey(ChildState));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks if the string associated to the <paramref name="propertyName"/> property of the <paramref name="stateView"/> state matches the pattern in <paramref name="textPattern"/>.
        /// </summary>
        /// <param name="stateView">The state view for the node with property <paramref name="propertyName"/>.</param>
        /// <param name="propertyName">Name of the property pointing to the template to check.</param>
        /// <param name="textPattern">Expected text.</param>
        public virtual bool StringMatchTextPattern(IFocusNodeStateView stateView, string propertyName, string textPattern)
        {
            IFocusNodeState State = stateView.State;

            Debug.Assert(State.InnerTable.ContainsKey(propertyName));

            bool IsHandled = false;
            bool Result    = false;

            switch (State.InnerTable[propertyName])
            {
            case IFocusPlaceholderInner AsPlaceholderInner:
                Debug.Assert(AsPlaceholderInner.InterfaceType.IsTypeof <Identifier>());
                IFocusPlaceholderNodeState ChildState = AsPlaceholderInner.ChildState as IFocusPlaceholderNodeState;
                Debug.Assert(ChildState != null);
                Result    = NodeTreeHelper.GetString(ChildState.Node, nameof(Identifier.Text)) == textPattern;
                IsHandled = true;
                break;
            }

            Debug.Assert(IsHandled);
            return(Result);
        }
 bool ICollection <IFocusPlaceholderNodeState> .Remove(IFocusPlaceholderNodeState item)
 {
     return(Remove((ILayoutPlaceholderNodeState)item));
 }
 bool ICollection <IFocusPlaceholderNodeState> .Contains(IFocusPlaceholderNodeState value)
 {
     return(Contains((ILayoutPlaceholderNodeState)value));
 }
 void ICollection <IFocusPlaceholderNodeState> .Add(IFocusPlaceholderNodeState item)
 {
     Add((ILayoutPlaceholderNodeState)item);
 }
 void IList <IFocusPlaceholderNodeState> .Insert(int index, IFocusPlaceholderNodeState item)
 {
     Insert(index, (ILayoutPlaceholderNodeState)item);
 }
 int IList <IFocusPlaceholderNodeState> .IndexOf(IFocusPlaceholderNodeState value)
 {
     return(IndexOf((ILayoutPlaceholderNodeState)value));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusPlaceholderNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The child node state.</param>
 public FocusPlaceholderNodeStateView(FocusControllerView controllerView, IFocusPlaceholderNodeState state)
     : base(controllerView, state)
 {
 }
 int IFocusPlaceholderNodeStateReadOnlyList.IndexOf(IFocusPlaceholderNodeState value)
 {
     return(IndexOf((ILayoutPlaceholderNodeState)value));
 }
 bool IFocusPlaceholderNodeStateReadOnlyList.Contains(IFocusPlaceholderNodeState value)
 {
     return(Contains((ILayoutPlaceholderNodeState)value));
 }