示例#1
0
        public void Publish(IObservableDataObject dataObject)
        {
            if (dataObjectToReference.ContainsKey(dataObject))
                return;

            var reference = CreateReference(dataObject);

            dataObject.PropertyChanged += (type, i) => referencesChanged.Add(reference);
        }
示例#2
0
        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;
        }
示例#3
0
 public Reference(IObservableDataObject dataObject, int localId)
 {
     DataObject = dataObject;
     LocalId = localId;
 }
示例#4
0
        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();
        }