Beispiel #1
0
        private protected virtual void PruneBlockListInner(IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> inner)
        {
            for (int BlockIndex = inner.BlockStateList.Count; BlockIndex > 0; BlockIndex--)
            {
                Action <IWriteableOperation>      HandlerRedo = (IWriteableOperation operation) => RedoRemoveBlockView(operation);
                Action <IWriteableOperation>      HandlerUndo = (IWriteableOperation operation) => throw new NotImplementedException(); // Undo is not possible.
                WriteableRemoveBlockViewOperation Operation   = CreateRemoveBlockViewOperation(inner.Owner.Node, inner.PropertyName, BlockIndex - 1, HandlerRedo, HandlerUndo, isNested: true);

                Operation.Redo();
            }

            Stats.BlockListCount--;
        }
Beispiel #2
0
        /// <summary>
        /// Handler called every time a block view must be removed from the controller view.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected virtual void OnBlockViewRemoved(WriteableRemoveBlockViewOperation operation)
        {
            IWriteableBlockState BlockState = operation.BlockState;

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

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

            foreach (IWriteableNodeState State in BlockState.StateList)
            {
                Debug.Assert(!StateViewTable.ContainsKey(State));
            }
        }
Beispiel #3
0
        private protected virtual void ExecuteRemoveBlockView(WriteableRemoveBlockViewOperation operation)
        {
            Node   ParentNode   = operation.ParentNode;
            string PropertyName = operation.PropertyName;
            IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> Inner = GetInner(ParentNode, PropertyName) as IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex>;
            IWriteableBlockState RemovedBlockState = (IWriteableBlockState)Inner.BlockStateList[operation.BlockIndex];

            for (int Index = 0; Index < RemovedBlockState.StateList.Count; Index++)
            {
                IWriteableNodeState State = (IWriteableNodeState)RemovedBlockState.StateList[Index];

                PruneState(State);
                Stats.PlaceholderNodeCount--;
            }

            IWriteableBrowsingPatternIndex PatternIndex = RemovedBlockState.PatternIndex;
            IWriteableBrowsingSourceIndex  SourceIndex  = RemovedBlockState.SourceIndex;

            Debug.Assert(PatternIndex != null);
            Debug.Assert(StateTable.ContainsKey(PatternIndex));
            Debug.Assert(SourceIndex != null);
            Debug.Assert(StateTable.ContainsKey(SourceIndex));

            RemoveState(PatternIndex);
            Stats.PlaceholderNodeCount--;

            RemoveState(SourceIndex);
            Stats.PlaceholderNodeCount--;

            Inner.NotifyBlockStateRemoved(RemovedBlockState);

            Stats.BlockCount--;

            operation.Update(RemovedBlockState);

            NotifyBlockViewRemoved(operation);
        }
Beispiel #4
0
 private protected virtual void NotifyBlockViewRemoved(WriteableRemoveBlockViewOperation operation)
 {
     BlockViewRemovedHandler?.Invoke(operation);
 }
Beispiel #5
0
        private protected virtual void RedoRemoveBlockView(IWriteableOperation operation)
        {
            WriteableRemoveBlockViewOperation RemoveBlockViewOperation = (WriteableRemoveBlockViewOperation)operation;

            ExecuteRemoveBlockView(RemoveBlockViewOperation);
        }