Пример #1
0
        /// <summary>
        /// Handler called every time a block state is changed in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected virtual void OnBlockStateChanged(WriteableChangeBlockOperation operation)
        {
            IWriteableBlockState BlockState = operation.BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(BlockStateViewTable.ContainsKey(BlockState));
        }
Пример #2
0
        private protected virtual void UndoChangeReplication(IWriteableOperation operation)
        {
            WriteableChangeBlockOperation ChangeBlockOperation = (WriteableChangeBlockOperation)operation;

            ChangeBlockOperation = ChangeBlockOperation.ToInverseChange();

            ExecuteChangeReplication(ChangeBlockOperation);
        }
Пример #3
0
        private protected virtual void ExecuteChangeReplication(WriteableChangeBlockOperation operation)
        {
            Node   ParentNode   = operation.ParentNode;
            string PropertyName = operation.PropertyName;
            IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex> Inner = GetInner(ParentNode, PropertyName) as IWriteableBlockListInner <IWriteableBrowsingBlockNodeIndex>;

            Inner.ChangeReplication(operation);

            NotifyBlockStateChanged(operation);
        }
        /// <summary>
        /// Changes the replication state of a block.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        public virtual void ChangeReplication(WriteableChangeBlockOperation operation)
        {
            ReplicationStatus Replication = operation.Replication;
            int BlockIndex = operation.BlockIndex;

            Debug.Assert(BlockIndex >= 0 && BlockIndex < BlockStateList.Count);

            IWriteableBlockState BlockState = (IWriteableBlockState)BlockStateList[BlockIndex];

            NodeTreeHelperBlockList.SetReplication(BlockState.ChildBlock, Replication);

            operation.Update(BlockState);
        }
Пример #5
0
        /// <summary>
        /// Changes the replication state of a block.
        /// </summary>
        /// <param name="inner">The inner where the blok is changed.</param>
        /// <param name="blockIndex">Position of the block in the block list.</param>
        /// <param name="replication">New replication value.</param>
        public virtual void ChangeReplication(IWriteableBlockListInner inner, int blockIndex, ReplicationStatus replication)
        {
            Contract.RequireNotNull(inner, out IWriteableBlockListInner Inner);
            Debug.Assert(blockIndex >= 0 && blockIndex < Inner.BlockStateList.Count);

            System.Action <IWriteableOperation> HandlerRedo = (IWriteableOperation operation) => RedoChangeReplication(operation);
            System.Action <IWriteableOperation> HandlerUndo = (IWriteableOperation operation) => UndoChangeReplication(operation);
            WriteableChangeBlockOperation       Operation   = CreateChangeBlockOperation(Inner.Owner.Node, Inner.PropertyName, blockIndex, replication, HandlerRedo, HandlerUndo, isNested: false);

            Operation.Redo();
            SetLastOperation(Operation);
            CheckInvariant();
        }
Пример #6
0
 private protected virtual void NotifyBlockStateChanged(WriteableChangeBlockOperation operation)
 {
     BlockStateChangedHandler?.Invoke(operation);
 }
Пример #7
0
        private protected virtual void RedoChangeReplication(IWriteableOperation operation)
        {
            WriteableChangeBlockOperation ChangeBlockOperation = (WriteableChangeBlockOperation)operation;

            ExecuteChangeReplication(ChangeBlockOperation);
        }