/// <summary>
        /// Initializes a new instance of the <see cref="ReadOnlyBlockState{IInner}"/> class.
        /// </summary>
        /// <param name="parentInner">Inner containing the block state.</param>
        /// <param name="newBlockIndex">Index that was used to create the block state.</param>
        /// <param name="childBlock">The block.</param>
        public ReadOnlyBlockState(IReadOnlyBlockListInner parentInner, IReadOnlyBrowsingNewBlockNodeIndex newBlockIndex, IBlock childBlock)
        {
            ParentInner = parentInner;
            ChildBlock  = childBlock;

            _StateList   = CreateStateList();
            StateList    = _StateList.ToReadOnly();
            PatternInner = CreatePatternInner(ParentInner.Owner);
            SourceInner  = CreateSourceInner(ParentInner.Owner);
        }
        /// <summary>
        /// Creates and initializes a new block state in the inner.
        /// </summary>
        /// <param name="newBlockIndex">Index of the new block state to create.</param>
        /// <returns>The created block state.</returns>
        public virtual IReadOnlyBlockState InitNewBlock(IReadOnlyBrowsingNewBlockNodeIndex newBlockIndex)
        {
            Debug.Assert(newBlockIndex.PropertyName == PropertyName);

            int BlockIndex = newBlockIndex.BlockIndex;

            Debug.Assert(BlockIndex == BlockStateList.Count);

            NodeTreeHelperBlockList.GetChildBlock(Owner.Node, PropertyName, BlockIndex, out IBlock ChildBlock);

            IReadOnlyBlockState BlockState = CreateBlockState(newBlockIndex, ChildBlock);

            InsertInBlockStateList(BlockIndex, BlockState);

            return(BlockState);
        }
示例#3
0
 /// <summary>
 /// Creates a IxxxBlockState object.
 /// </summary>
 private protected override IReadOnlyBlockState CreateBlockState(IReadOnlyBrowsingNewBlockNodeIndex nodeIndex, IBlock childBlock)
 {
     ControllerTools.AssertNoOverride(this, Type.FromTypeof <LayoutBlockListInner <IIndex> >());
     return(new LayoutBlockState <ILayoutInner <ILayoutBrowsingChildIndex> >(this, (ILayoutBrowsingNewBlockNodeIndex)nodeIndex, childBlock));
 }
 /// <summary>
 /// Creates a IxxxBlockState object.
 /// </summary>
 private protected override IReadOnlyBlockState CreateBlockState(IReadOnlyBrowsingNewBlockNodeIndex nodeIndex, IBlock childBlock)
 {
     ControllerTools.AssertNoOverride(this, typeof(FocusBlockListInner <IIndex, TIndex>));
     return(new FocusBlockState <IFocusInner <IFocusBrowsingChildIndex> >(this, (IFocusBrowsingNewBlockNodeIndex)nodeIndex, childBlock));
 }
 /// <summary>
 /// Creates a IxxxBlockState object.
 /// </summary>
 private protected virtual IReadOnlyBlockState CreateBlockState(IReadOnlyBrowsingNewBlockNodeIndex nodeIndex, IBlock childBlock)
 {
     ControllerTools.AssertNoOverride(this, typeof(ReadOnlyBlockListInner <IIndex, TIndex>));
     return(new ReadOnlyBlockState <IReadOnlyInner <IReadOnlyBrowsingChildIndex> >(this, nodeIndex, childBlock));
 }