Example #1
0
        override internal void OnObjectRemoved(ObjectRemovedPayload data)
        {
            Debug.Assert(this.IsConnected == false || this.OperationSequence == 0 || data.OperationSequence == this.OperationSequence + 1);
            this.OperationSequence = data.OperationSequence;

            // Check if this is a locally pending delete, if so remove the delete from the list of LocalOperations
            if (data.ClientId == this.client.ClientId)
            {
                this.ProcessAck(OperationAction.Remove, data.ObjectId);
                return;
            }

            // Apply transformation, update index
            CollectionOperation operation = new CollectionOperation(data);

            this.ApplyTransform(this, ref operation);
            data.Parent.Index = operation.ObjectIndex;

            if (operation.ApplyOperation)
            {
                Debug.Assert(CollectionIndices[operation.ObjectIndex] == data.ObjectId);
                BaseOnObjectRemoved(data.ObjectId);
            }
            else
            {
                Debug.WriteLine(string.Format("[OrderedCollection] - Client={0}: REMOTE NOT Deleting {1} Index {2}", this.client.ClientId, data.ObjectId, operation.ObjectIndex));
            }
        }
Example #2
0
        private void SendObjectRemovedPayload(ObjectRemovedPayload data)
        {
            // Add to pending list
            CollectionOperation change = new CollectionOperation(data);

            this.LocalOperations.Add(change);

            this.client.SendPublishEvent(data);
        }
Example #3
0
        override internal void OnObjectRemoved(ObjectRemovedPayload data)
        {
            // Check if this is a locally pending delete, if so remove the delete from the list of LocalOperations
            if (data.ClientId == this.client.ClientId)
            {
                Debug.Assert(UnackedMessages > 0);
                --UnackedMessages;
                return;
            }

            BaseOnObjectRemoved(data.ObjectId);
        }
Example #4
0
        private void OnObjectRemoved(ObjectRemovedPayload data)
        {
            CollectionEntry collectionEntry;

            if (!this.TryGetValue(data.Parent.Id, out collectionEntry))
            {
                Debug.WriteLine("Missing collection for incoming object removal");
                return;
            }

            // Route removal request to the collection entry
            collectionEntry.OnObjectRemoved(data);
        }
Example #5
0
        private void RemoveSharedObjects(IList items)
        {
            Debug.Assert(client.CheckAccess());
            this.MasterCollection.VerifyConnected();

            foreach (INotifyPropertyChanged removedObj in items)
            {
                ObjectEntry objectEntry;
                if (RemoveSharedObject(removedObj, out objectEntry))
                {
                    Debug.WriteLine(string.Format("[UnorderedCollection] - Client={0}: LOCAL Deleting {1}", this.client.ClientId, objectEntry.Object));

                    var data = new ObjectRemovedPayload(this.Id, objectEntry.Id, this.client.ClientId);
                    this.SendObjectRemovedPayload(data);
                }
            }
        }
Example #6
0
        private void RemoveSharedObjects(IList items)
        {
            Debug.Assert(client.CheckAccess());
            this.MasterCollection.VerifyConnected();

            foreach (INotifyPropertyChanged removedObj in items)
            {
                ObjectEntry objectEntry;
                if (RemoveSharedObject(removedObj, out objectEntry))
                {
                    // Get index before removing
                    int index = this.CollectionIndices.IndexOf(objectEntry.Id);

                    // Now we can remove from index list
                    this.CollectionIndices.Remove(objectEntry.Id);

                    Debug.WriteLine(string.Format("[OrderedCollection] - Client={0}: LOCAL Deleting {1} Index {2}", this.client.ClientId, objectEntry.Object, index));

                    var data = new ObjectRemovedPayload(this.Id, objectEntry.Id, index, this.OperationSequence, this.client.ClientId);
                    this.SendObjectRemovedPayload(data);
                }
            }
        }
Example #7
0
 public CollectionOperation(ObjectRemovedPayload data)
     : this(data as CollectionChangedPayload)
 {
     this.Action = OperationAction.Remove;
 }
Example #8
0
 private void SendObjectRemovedPayload(ObjectRemovedPayload data)
 {
     this.client.SendPublishEvent(data);
     ++UnackedMessages;
 }
Example #9
0
 abstract internal void OnObjectRemoved(ObjectRemovedPayload data);