/// <summary> /// Reduces the block list. /// </summary> private protected virtual void ReduceBlockList(IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> blockListInner, WriteableOperationList operationList, bool isNested) { if (!blockListInner.IsSingle) { return; } if (NodeHelper.IsCollectionNeverEmpty(blockListInner.Owner.Node, blockListInner.PropertyName)) { return; } if (!NodeHelper.IsCollectionWithExpand(blockListInner.Owner.Node, blockListInner.PropertyName)) { return; } Debug.Assert(blockListInner.BlockStateList.Count == 1); Debug.Assert(blockListInner.BlockStateList[0].StateList.Count == 1); IWriteableNodeState FirstState = (IWriteableNodeState)blockListInner.BlockStateList[0].StateList[0]; if (!NodeHelper.IsDefaultNode(FirstState.Node)) { return; } Action <IWriteableOperation> HandlerRedo = (IWriteableOperation operation) => RedoRemoveBlock(operation); Action <IWriteableOperation> HandlerUndo = (IWriteableOperation operation) => UndoRemoveBlock(operation); IWriteableRemoveBlockOperation Operation = CreateRemoveBlockOperation(blockListInner.Owner.Node, blockListInner.PropertyName, 0, HandlerRedo, HandlerUndo, isNested); Operation.Redo(); operationList.Add(Operation); }
private protected virtual void RemoveBlock(IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> blockListInner, int blockIndex) { System.Action <IWriteableOperation> HandlerRedo = (IWriteableOperation operation) => RedoRemoveBlock(operation); System.Action <IWriteableOperation> HandlerUndo = (IWriteableOperation operation) => UndoRemoveBlock(operation); IWriteableRemoveBlockOperation Operation = CreateRemoveBlockOperation(blockListInner.Owner.Node, blockListInner.PropertyName, blockIndex, HandlerRedo, HandlerUndo, isNested: false); Operation.Redo(); SetLastOperation(Operation); CheckInvariant(); }