예제 #1
0
 /// <summary>
 /// Create the normal beacon message
 /// </summary>
 /// <returns></returns>
 protected Message InstructorMakeBeaconMessage()
 {
     using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
         using (Synchronizer.Lock(this.m_Model.Participant.Role.SyncRoot)) {
             Message         role       = RoleMessage.ForRole(this.m_Model.Participant.Role);
             InstructorModel instructor = ((InstructorModel)this.m_Model.Participant.Role);
             if (instructor.CurrentPresentation != null)
             {
                 role.InsertChild(new InstructorCurrentPresentationChangedMessage(instructor.CurrentPresentation));
             }
             if (instructor.CurrentDeckTraversal != null)
             {
                 using (Synchronizer.Lock(instructor.CurrentDeckTraversal.SyncRoot)) {
                     Message traversal   = new InstructorCurrentDeckTraversalChangedMessage(instructor.CurrentDeckTraversal);
                     Message predecessor = traversal.Predecessor;
                     traversal.Predecessor = new SlideInformationMessage(instructor.CurrentDeckTraversal.Current.Slide);
                     traversal.Predecessor.InsertChild(new TableOfContentsEntryMessage(instructor.CurrentDeckTraversal.Current));
                     traversal.Predecessor.AddOldestPredecessor(predecessor);
                     role.InsertChild(traversal);
                 }
             }
             return(role);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// If current role is public, then resend RoleMessage and GroupMessage for reconnection
        /// </summary>
        private void SendRoleAndGroupMessage(TCPMessageSender sender)
        {
            using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
                if (this.m_Model.Participant.Role is PublicModel)
                {
                    //Send RoleMessage
                    UW.ClassroomPresenter.Network.Messages.Message message = RoleMessage.ForRole(this.m_Model.Participant.Role);
                    message.Group = Group.AllParticipant;
                    sender.Send(message);

                    //Send GroupMessage
                    foreach (Group group in this.m_Model.Participant.Groups)
                    {
                        message       = new ParticipantGroupAddedMessage(group);
                        message.Group = Group.AllParticipant;
                        sender.Send(message);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Even though we are not an instructor, here we fake an instructor beacon message for the purpose of unicast to multicast
        /// bridging.
        /// </summary>
        /// <returns></returns>
        protected Message NonInstructorMakeBeaconMessage()
        {
            InstructorModel instructor = new InstructorModel(m_NonInstructorId);
            Message         role       = RoleMessage.ForRole(instructor);

            using (Synchronizer.Lock(this.m_Model.Workspace)) {
                if (this.m_Model.Workspace.CurrentPresentation != null)
                {
                    using (Synchronizer.Lock(this.m_Model.Workspace.CurrentPresentation.SyncRoot)) {
                        if (this.m_Model.Workspace.CurrentPresentation.Value != null)
                        {
                            role.InsertChild(new InstructorCurrentPresentationChangedMessage(this.m_Model.Workspace.CurrentPresentation));
                        }
                    }
                }

                if (this.m_Model.Workspace.CurrentDeckTraversal != null)
                {
                    using (Synchronizer.Lock(this.m_Model.Workspace.CurrentDeckTraversal.SyncRoot)) {
                        if (this.m_Model.Workspace.CurrentDeckTraversal.Value != null)
                        {
                            Message traversal   = new InstructorCurrentDeckTraversalChangedMessage(this.m_Model.Workspace.CurrentDeckTraversal.Value, false);
                            Message predecessor = traversal.Predecessor;
                            using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                                using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).Current.SyncRoot)) {
                                    traversal.Predecessor = new SlideInformationMessage((~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide);
                                    TableOfContentsModel.Entry entry = (~this.m_Model.Workspace.CurrentDeckTraversal).Current;
                                    if (entry != null)
                                    {
                                        traversal.Predecessor.InsertChild(new TableOfContentsEntryMessage(entry));
                                    }
                                    traversal.Predecessor.AddOldestPredecessor(predecessor);
                                    role.InsertChild(traversal);
                                }
                            }
                        }
                    }
                }
            }
            return(role);
        }