private void ProcessCP3Message(CP3.Network.Messages.Message m) { if (m is CP3.Network.Messages.Presentation.DeckInformationMessage) { CP3.Network.Messages.Presentation.DeckInformationMessage dim = (CP3.Network.Messages.Presentation.DeckInformationMessage)m; if ((dim.Disposition == UW.ClassroomPresenter.Model.Presentation.DeckDisposition.Whiteboard) || (dim.Disposition == UW.ClassroomPresenter.Model.Presentation.DeckDisposition.StudentSubmission) || (dim.Disposition == UW.ClassroomPresenter.Model.Presentation.DeckDisposition.QuickPoll)) { return; } if (!decks.ContainsKey(dim.TargetId)) { Deck thisDeck = new Deck(dim); decks.Add(dim.TargetId, thisDeck); if (this.OnDeckFound != null) { OnDeckFound(thisDeck); } } } else if (m is CP3.Network.Messages.Network.InstructorCurrentDeckTraversalChangedMessage) { CP3.Network.Messages.Network.InstructorCurrentDeckTraversalChangedMessage im = (CP3.Network.Messages.Network.InstructorCurrentDeckTraversalChangedMessage)m; if (((im.Dispositon & UW.ClassroomPresenter.Model.Presentation.DeckDisposition.Whiteboard) == 0) && (!this.unnamedDecks.ContainsKey(im.DeckId))) { // This case captures all the decks, including cases where the deck is opened before // the start of archiving, and there are no slide transitions within the deck, but // one slide is shown. These need to be manually matched since we don't know the deck name. // At the end of processing we merge these into the main decks collection. this.unnamedDecks.Add(im.DeckId, new Deck(im.DeckId)); } } }
/// <summary> /// This is a message used in the beacon, and it is also the message that indicates when /// an instructor navigates to an initial slide in a newly opened deck. /// </summary> /// <param name="icdtcm"></param> /// <returns></returns> /// This is the beacon message graph we expect: /// {InstructorMessage; /// child={InstructorCurrentDeckTraversalChangedMessage; /// pred={SlideInformationMessage; /// pred={InstructorCurrentPresentationChangedMessage;}; /// child={TableOfContentsEntryMessage;};};};} internal List <object> AddInstructorCurrentDeckTraversalChanged(UW.ClassroomPresenter.Network.Messages.Network.InstructorCurrentDeckTraversalChangedMessage icdtcm) { //If m.Predecessor.Child is a TOC entry, return a RTUPdate. List <object> outputMessages = null; if ((icdtcm.Predecessor != null) && (icdtcm.Predecessor.Child != null) && (icdtcm.Predecessor is CP3Msgs.SlideInformationMessage) && (icdtcm.Predecessor.Child is CP3Msgs.TableOfContentsEntryMessage)) { if (icdtcm.Predecessor.Predecessor == null) //This effectively filters out the beacon messages. //In some late-joiner scenarios, we may not have the TOC entry. { if (!toc.ContainsEntry((Guid)icdtcm.Predecessor.Child.TargetId)) { string err; Guid slideId = toc.AddTableOfContentsEntry((CP3Msgs.TableOfContentsEntryMessage)icdtcm.Predecessor.Child, icdtcm.DeckId, icdtcm.Dispositon, out err); if (err != null) { Debug.WriteLine(err); } else if (!slideId.Equals(Guid.Empty)) { outputMessages = this.getCachedStrokes(slideId); } } if (currentDeckId.Equals(icdtcm.DeckId) && currentSlideId.Equals((Guid)icdtcm.Predecessor.TargetId)) { Debug.WriteLine("***Ignoring InstructorCurrentDeckTraversalChanged because it matches the current slide and deck"); return(outputMessages); } RTUpdate rtu = this.toc.GetRtUpdate((Guid)icdtcm.Predecessor.Child.TargetId); if (rtu != null) { currentDeckId = icdtcm.DeckId; currentSlideId = (Guid)icdtcm.Predecessor.TargetId; } else { Debug.WriteLine("Warning: Navigation failure."); } if (outputMessages == null) { outputMessages = new List <object>(); } outputMessages.Add(rtu); return(outputMessages); } else { //The beacon also causes navigation in some cases, eg. the initial slide after we join. //If the beacon has a toc entry we don't already have, add it. if (!toc.ContainsEntry((Guid)icdtcm.Predecessor.Child.TargetId)) { string err; Guid slideId = toc.AddTableOfContentsEntry((CP3Msgs.TableOfContentsEntryMessage)icdtcm.Predecessor.Child, icdtcm.DeckId, icdtcm.Dispositon, out err); if (err != null) { Debug.WriteLine(err); } else if (!slideId.Equals(Guid.Empty)) { outputMessages = this.getCachedStrokes(slideId); } } //if the beacon indicates a slide other than the current slide, navigate there. if ((!currentSlideId.Equals((Guid)icdtcm.Predecessor.TargetId)) || (!currentDeckId.Equals(icdtcm.DeckId))) { currentSlideId = (Guid)icdtcm.Predecessor.TargetId; RTUpdate rtu = this.toc.GetRtUpdate((Guid)icdtcm.Predecessor.Child.TargetId); currentDeckId = (Guid)icdtcm.DeckId; currentSlideId = (Guid)icdtcm.Predecessor.TargetId; if (outputMessages == null) { outputMessages = new List <object>(); } outputMessages.Add(rtu); return(outputMessages); } } } else { warning += "Warning: Found InstructorCurrentDeckTraversalChangedMessage message without a TOC Entry. "; } return(outputMessages); }