/// <summary> /// Send a network message with the updated deck traversal /// </summary> /// <param name="receivers"></param> private void SendCurrentDeckTraversalChange(Group receivers) { using (Synchronizer.Lock(this.m_Instructor.SyncRoot)) { DeckTraversalModel traversal = this.m_Instructor.CurrentDeckTraversal; if (traversal != null) { Message message = new InstructorMessage(this.m_Instructor); message.Group = receivers; // Create a SlideMessage/TableOfContentsEntryMessage which will be the // InstructorCurrentDeckTraversalChangedMessage's predecessor. using (Synchronizer.Lock(traversal.SyncRoot)) { Message slide = new SlideInformationMessage(traversal.Current.Slide); using (Synchronizer.Lock(traversal.Deck.SyncRoot)) { if ((traversal.Deck.Disposition & (DeckDisposition.StudentSubmission | DeckDisposition.QuickPoll)) != 0) { slide.Group = Groups.Group.Submissions; } } slide.InsertChild(new TableOfContentsEntryMessage(traversal.Current)); message.InsertChild(slide); } message.InsertChild(new InstructorCurrentDeckTraversalChangedMessage(traversal)); #if DEBUG // Add logging of slide change events string pres_name = ""; using (Synchronizer.Lock(this.m_CurrentPresentation.SyncRoot)) pres_name = this.m_CurrentPresentation.HumanName; string deck_name = ""; using (Synchronizer.Lock(traversal.Deck.SyncRoot)) deck_name = traversal.Deck.HumanName; int slide_index = 0; Guid slide_guid = Guid.Empty; using (Synchronizer.Lock(traversal.SyncRoot)) { if (traversal.Current != null) { using (Synchronizer.Lock(traversal.Current.SyncRoot)) { slide_index = traversal.Current.IndexInParent; using (Synchronizer.Lock(traversal.Current.Slide.SyncRoot)) { slide_guid = traversal.Current.Slide.Id; } } } } Debug.WriteLine(string.Format("DECK CHANGE ({0}): Pres -- {1}, Deck -- {2}, Slide -- {3}, Guid -- {4}", System.DateTime.Now.Ticks, pres_name, deck_name, slide_index, slide_guid)); #endif message.Tags = new MessageTags(); message.Tags.BridgePriority = MessagePriority.Higher; this.Sender.Send(message); } } }
/// <summary> /// Send a PresentationStartedMessage /// </summary> /// <param name="receivers">The group of receivers to get this message</param> private void SendPresentationStartedMessage(Group receivers) { // Caller must lock(this). Debug.Assert(this.m_CurrentPresentation != null); // FIXME: Send a message if the instructor's CurrentPresentation is set to null. if (this.m_CurrentPresentation != null) { Message message = new InstructorMessage(this.m_Instructor); message.Group = receivers; message.InsertChild(new InstructorCurrentPresentationChangedMessage(this.m_CurrentPresentation)); this.Sender.Send(message); } }
/// <summary> /// Send a network message with the updated deck traversal /// </summary> /// <param name="receivers"></param> private void SendCurrentDeckTraversalChange(Group receivers) { using(Synchronizer.Lock(this.m_Instructor.SyncRoot)) { DeckTraversalModel traversal = this.m_Instructor.CurrentDeckTraversal; if(traversal != null) { Message message = new InstructorMessage(this.m_Instructor); message.Group = receivers; // Create a SlideMessage/TableOfContentsEntryMessage which will be the // InstructorCurrentDeckTraversalChangedMessage's predecessor. using (Synchronizer.Lock(traversal.SyncRoot)) { Message slide = new SlideInformationMessage(traversal.Current.Slide); using (Synchronizer.Lock(traversal.Deck.SyncRoot)) { if( (traversal.Deck.Disposition & (DeckDisposition.StudentSubmission | DeckDisposition.QuickPoll) ) != 0 ) slide.Group = Groups.Group.Submissions; } slide.InsertChild(new TableOfContentsEntryMessage(traversal.Current)); message.InsertChild(slide); } message.InsertChild(new InstructorCurrentDeckTraversalChangedMessage(traversal)); #if DEBUG // Add logging of slide change events string pres_name = ""; using( Synchronizer.Lock( this.m_CurrentPresentation.SyncRoot ) ) pres_name = this.m_CurrentPresentation.HumanName; string deck_name = ""; using( Synchronizer.Lock( traversal.Deck.SyncRoot ) ) deck_name = traversal.Deck.HumanName; int slide_index = 0; Guid slide_guid = Guid.Empty; using( Synchronizer.Lock( traversal.SyncRoot ) ) { if( traversal.Current != null ) using (Synchronizer.Lock(traversal.Current.SyncRoot)) { slide_index = traversal.Current.IndexInParent; using (Synchronizer.Lock(traversal.Current.Slide.SyncRoot)) { slide_guid = traversal.Current.Slide.Id; } } } Debug.WriteLine( string.Format( "DECK CHANGE ({0}): Pres -- {1}, Deck -- {2}, Slide -- {3}, Guid -- {4}", System.DateTime.Now.Ticks, pres_name, deck_name, slide_index, slide_guid ) ); #endif message.Tags = new MessageTags(); message.Tags.BridgePriority = MessagePriority.Higher; this.Sender.Send(message); } } }