public void Publish(IObservableDataObject dataObject) { if (dataObjectToReference.ContainsKey(dataObject)) return; var reference = CreateReference(dataObject); dataObject.PropertyChanged += (type, i) => referencesChanged.Add(reference); }
private Reference CreateReference(IObservableDataObject dataObject) { var localId = Interlocked.Increment(ref localIdCounter); var reference = new Reference(dataObject, localId); localIdToReference.Add(localId, reference); dataObjectToReference.Add(dataObject, reference); return reference; }
public Reference(IObservableDataObject dataObject, int localId) { DataObject = dataObject; LocalId = localId; }
public void Subscribe(IObservableDataObject dataObject, RemotingPeer peer, int remoteId) { Reference reference; if (!dataObjectToReference.TryGetValue(dataObject, out reference)) reference = CreateReference(dataObject); reference.Subscription = new Subscription(peer, remoteId); subscriptionToReference.Add(reference.Subscription, reference); var data = new Message(peer, remotingManager, reference.LocalId, remoteId, MessageType.ReferenceSubscribe); data.Dispatch(); }