Ejemplo n.º 1
0
        /// <summary>
        /// Called when a VersionRequestMessage is received
        /// </summary>
        /// <param name="remoteParticipant"></param>
        /// <param name="version"></param>
        public void ReceiveVersionRequest(ParticipantModel remoteParticipant, VersionRequestMessage requestMessage)
        {
            Trace.WriteLine("VersionExchangeModel.ReceiveVersionRequest started. remoteParticipant=" +
                            remoteParticipant.Guid.ToString() + "; requesterID= " + requestMessage.RequesterId.ToString());
            VersionExchange ve;

            //Make a VersionExchange object if needed.
            using (Synchronizer.Lock(this.SyncRoot)) {
                if (m_VersionExchangeDictionary.ContainsKey(remoteParticipant.Guid))
                {
                    ve = m_VersionExchangeDictionary[remoteParticipant.Guid];
                }
                else
                {
                    //This probably should not happen, but if it does we are covered.
                    ve = new VersionExchange(remoteParticipant);
                    m_VersionExchangeDictionary.Add(remoteParticipant.Guid, ve);
                    m_VersionExchanges.Add(ve);
                    Trace.WriteLine("Created a VersionExchange in response to Version Request from participant: " + remoteParticipant.Guid.ToString());
                }
            }

            //Let the VersionExchange object process the inbound message
            ve.ReceiveRequest(requestMessage.RequesterVersion);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// When a participant is removed from a classroom, clean up the version exchange
        /// </summary>
        /// <param name="value"></param>
        internal void RemoveVersionExchange(ParticipantModel participant)
        {
            if ((participant.Guid.Equals(Guid.Empty)) ||
                (participant.Guid.Equals(PresenterModel.ParticipantId)) ||
                (!m_VersionExchangeDictionary.ContainsKey(participant.Guid)))
            {
                return;
            }

            using (Synchronizer.Lock(this.SyncRoot)) {
                Trace.WriteLine("Removing VersionExchange for participant: " + participant.Guid.ToString());
                VersionExchange ve = m_VersionExchangeDictionary[participant.Guid];
                m_VersionExchanges.Remove(ve);
                m_VersionExchangeDictionary.Remove(participant.Guid);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// If the participant is not identical to the local node, does not have a Guid.Empty identifier, and
 /// and if a VersionExchange has not already been created, create one here.  In some cases
 /// (notably if the local node is an instructor) this will cause the exchange to begin.
 /// </summary>
 /// <param name="participant"></param>
 public void CreateVersionExchange(ParticipantModel participant)
 {
     if ((participant.Guid.Equals(Guid.Empty)) ||
         (participant.Guid.Equals(PresenterModel.ParticipantId)) ||
         (m_VersionExchangeDictionary.ContainsKey(participant.Guid)))
     {
         return;
     }
     using (Synchronizer.Lock(this.SyncRoot)) {
         if (!m_VersionExchangeDictionary.ContainsKey(participant.Guid))
         {
             VersionExchange ve = new VersionExchange(participant);
             m_VersionExchangeDictionary.Add(participant.Guid, ve);
             //Adding to the collection here triggers an event in the corresponding Network Service
             m_VersionExchanges.Add(ve);
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Called when a VersionResponseMessage is received
        /// </summary>
        /// <param name="participantModel"></param>
        /// <param name="versionResponseMessage"></param>
        internal void ReceiveVersionResponse(ParticipantModel remoteParticipant, VersionResponseMessage versionResponseMessage)
        {
            Trace.WriteLine("VersionExchangeModel.ReceiveVersionResponse started. remoteParticipant=" +
                            remoteParticipant.Guid.ToString() + ";responderID=" + versionResponseMessage.ResponderId.ToString());

            VersionExchange ve = null;

            //Look up the VersionExchange for this remote participant
            using (Synchronizer.Lock(this.SyncRoot)) {
                if (m_VersionExchangeDictionary.ContainsKey(versionResponseMessage.ResponderId))
                {
                    ve = m_VersionExchangeDictionary[versionResponseMessage.ResponderId];
                }
            }
            //Let the VersionExchange handle the inbound message.
            if (ve != null)
            {
                ve.ReceiveResponse(versionResponseMessage);
            }
            else
            {
                Trace.WriteLine("Warning: Failed to find a pending version exchange to match inbound response message from participant: " + remoteParticipant.Guid.ToString());
            }
        }
 public void Insert(int index, VersionExchange value)
 {
     List.Insert(index, value);
 }
 public void Remove(VersionExchange value)
 {
     List.Remove(value);
 }
 public bool Contains(VersionExchange value)
 {
     return List.Contains(value);
 }
 public int IndexOf(VersionExchange value)
 {
     return List.IndexOf(value);
 }
        /// <summary>
        /// Called when a VersionRequestMessage is received
        /// </summary>
        /// <param name="remoteParticipant"></param>
        /// <param name="version"></param>
        public void ReceiveVersionRequest(ParticipantModel remoteParticipant, VersionRequestMessage requestMessage)
        {
            Trace.WriteLine("VersionExchangeModel.ReceiveVersionRequest started. remoteParticipant=" +
                remoteParticipant.Guid.ToString() + "; requesterID= " + requestMessage.RequesterId.ToString());
            VersionExchange ve;
            //Make a VersionExchange object if needed.
            using (Synchronizer.Lock(this.SyncRoot)) {
                if (m_VersionExchangeDictionary.ContainsKey(remoteParticipant.Guid)) {
                    ve = m_VersionExchangeDictionary[remoteParticipant.Guid];
                }
                else {
                    //This probably should not happen, but if it does we are covered.
                    ve = new VersionExchange(remoteParticipant);
                    m_VersionExchangeDictionary.Add(remoteParticipant.Guid, ve);
                    m_VersionExchanges.Add(ve);
                    Trace.WriteLine("Created a VersionExchange in response to Version Request from participant: " + remoteParticipant.Guid.ToString());
                }
            }

            //Let the VersionExchange object process the inbound message
            ve.ReceiveRequest(requestMessage.RequesterVersion);
        }
 public int Add(VersionExchange value)
 {
     return List.Add(value);
 }
 private void SendVersionResponse(VersionExchange ve, VersionResponseMessage vrm)
 {
     vrm.Group = new SingletonGroup(ve.RemoteParticipant);
     vrm.Tags = new MessageTags();
     vrm.Tags.BridgePriority = MessagePriority.Lowest;
     m_Service.m_Sender.Send(vrm);
     Trace.WriteLine("Sent VersionResponseMessage to Participant ID: " + ve.RemoteParticipant.Guid.ToString());
 }
 /// <summary>
 /// If the participant is not identical to the local node, does not have a Guid.Empty identifier, and
 /// and if a VersionExchange has not already been created, create one here.  In some cases 
 /// (notably if the local node is an instructor) this will cause the exchange to begin.
 /// </summary>
 /// <param name="participant"></param>
 public void CreateVersionExchange(ParticipantModel participant)
 {
     if ((participant.Guid.Equals(Guid.Empty)) ||
         (participant.Guid.Equals(PresenterModel.ParticipantId)) ||
         (m_VersionExchangeDictionary.ContainsKey(participant.Guid))) {
         return;
     }
     using (Synchronizer.Lock(this.SyncRoot)) {
         if (!m_VersionExchangeDictionary.ContainsKey(participant.Guid)) {
             VersionExchange ve = new VersionExchange(participant);
             m_VersionExchangeDictionary.Add(participant.Guid, ve);
             //Adding to the collection here triggers an event in the corresponding Network Service
             m_VersionExchanges.Add(ve);
         }
     }
 }
Ejemplo n.º 13
0
 public int Add(VersionExchange value)
 {
     return(List.Add(value));
 }
Ejemplo n.º 14
0
 public int IndexOf(VersionExchange value)
 {
     return(List.IndexOf(value));
 }
Ejemplo n.º 15
0
 public void Insert(int index, VersionExchange value)
 {
     List.Insert(index, value);
 }
Ejemplo n.º 16
0
 public bool Contains(VersionExchange value)
 {
     return(List.Contains(value));
 }
Ejemplo n.º 17
0
 public void Remove(VersionExchange value)
 {
     List.Remove(value);
 }