/// <summary>
        /// When a new quickpoll is started we get this with parents: QuickPollInformationMessage, Slide..,Deck..,Presentation..
        /// The SheetMessage base class has dimensions, but they appear to all be zeros.
        /// </summary>
        /// <param name="quickPollSheetMessage"></param>
        /// <returns></returns>
        internal object AddQuickPollSheet(UW.ClassroomPresenter.Network.Messages.Presentation.QuickPollSheetMessage qpsm)
        {
            if ((qpsm.Parent is CP3Msgs.QuickPollInformationMessage) &&
                (qpsm.Parent.Parent is CP3Msgs.SlideInformationMessage) &&
                (qpsm.Parent.Parent.Parent is CP3Msgs.DeckInformationMessage) &&
                (qpsm.Parent.Parent.Parent.Parent is CP3Msgs.PresentationInformationMessage))
            {
                CP3Msgs.QuickPollInformationMessage qpim = (CP3Msgs.QuickPollInformationMessage)qpsm.Parent;
                CP3Msgs.SlideInformationMessage     sim  = (CP3Msgs.SlideInformationMessage)qpsm.Parent.Parent;
                CP3Msgs.DeckInformationMessage      dim  = (CP3Msgs.DeckInformationMessage)qpsm.Parent.Parent.Parent;
                CP3Msgs.QuickPollMessage            qpm  = (CP3Msgs.QuickPollMessage)qpim;

                // Note: OriginalSlideId is not in the TOC.  What is that??
                //TableOfContents.TocEntry te = toc.LookupBySlideId(qpModel.OriginalSlideId);

                /// sim.TargetID seems to give us a good TOC entry for the quickpoll
                /// slide with association information filled in correctly:
                TableOfContents.TocEntry qptoc = toc.LookupBySlideId((Guid)sim.TargetId);
                if (qptoc == null)
                {
                    Debug.WriteLine("***Failed to find slide for QuickPoll Sheet!");
                    return(null);
                }

                m_QuickPollAggregator.AddQuickPoll(qpm.Model);
                toc.AddQuickPollIdForSlide((Guid)sim.TargetId, qpm.Model.Id);

                //Send the initial RtQuickPoll with empty results
                int[] results = new int[0];
                ArchiveRTNav.RTQuickPoll rtqp = new ArchiveRTNav.RTQuickPoll((ArchiveRTNav.QuickPollStyle)qpm.Model.PollStyle, results, qptoc.DeckId, qptoc.SlideIndex);
                return(rtqp);
            }
            else
            {
                Debug.WriteLine("****Unexpected QuickPollSheetMessage: " + qpsm.ToString());
            }
            return(null);
        }
        /// <summary>
        /// When there is a vote we get this with parents: QuickPollInformationMessage, Presentation..
        /// Contains a owner ID and a result string such as "C" or "Yes".
        /// Presumably the owner ID is the id of the client, so this is how we would know if a client changed his vote.
        /// </summary>
        /// <param name="quickPollResultInformationMessage"></param>
        /// <returns></returns>
        internal object AddQuickResultInformation(UW.ClassroomPresenter.Network.Messages.Presentation.QuickPollResultInformationMessage qprim)
        {
            if (qprim.Parent is CP3Msgs.QuickPollInformationMessage)
            {
                CP3Msgs.QuickPollInformationMessage qpim  = (CP3Msgs.QuickPollInformationMessage)qprim.Parent;
                TableOfContents.TocEntry            qptoc = toc.LookupByQuickPollId((Guid)qpim.TargetId);
                if (qptoc == null)
                {
                    Debug.WriteLine("***QuickPoll Result received for unknown QuickPoll!!");
                    return(null);
                }

                int[] currentvotes = m_QuickPollAggregator.AcceptResult(qprim.Result, (Guid)qpim.TargetId);

                ArchiveRTNav.RTQuickPoll rtqp = new ArchiveRTNav.RTQuickPoll((ArchiveRTNav.QuickPollStyle)qpim.Model.PollStyle, currentvotes, qptoc.DeckId, qptoc.SlideIndex);
                return(rtqp);
            }
            else
            {
                Debug.WriteLine("****Unexpected QuickPollResultInformation Message.");
            }
            return(null);
        }
Beispiel #3
0
        private void AcceptCP3Chunk(UW.ClassroomPresenter.Network.Chunking.Chunk chunk)
        {
            List <object> rtObjList = cp3Mgr.Accept(chunk);

            if ((rtObjList == null) || (rtObjList.Count == 0))
            {
                if (cp3Mgr.WarningLog != null)
                {
                    foreach (string s in cp3Mgr.WarningLog)
                    {
                        Debug.WriteLine(s);
                    }
                    cp3Mgr.WarningLog.Clear();
                }
                FilterCP3RTUpdate();
                return;
            }

            foreach (object rto in rtObjList)
            {
                if (rto is ArchiveRTNav.RTUpdate)
                {
                    Debug.WriteLine("**CP3Mgr returns RtUpdate: " + ((RTUpdate)rto).ToString());
                    UpdateRTUpdate((RTUpdate)rto);
                    FilterCP3RTUpdate();
                }
                else if (rto is ArchiveRTNav.RTDrawStroke)
                {
                    FilterRTDrawStroke((RTDrawStroke)rto);
                }
                else if (rto is ArchiveRTNav.RTDeleteStroke)
                {
                    FilterRTDeleteStroke((RTDeleteStroke)rto);
                }
                else if (rto is ArchiveRTNav.RTTextAnnotation)
                {
                    FilterRTTextAnnotation((RTTextAnnotation)rto);
                }
                else if (rto is ArchiveRTNav.RTImageAnnotation)
                {
                    FilterRTImageAnnotation((RTImageAnnotation)rto);
                }
                else if ((rto is ArchiveRTNav.RTDeleteTextAnnotation))
                {
                    FilterRTDeleteTextAnnotation((RTDeleteTextAnnotation)rto);
                }
                else if ((rto is ArchiveRTNav.RTDeleteAnnotation))
                {
                    FilterRTDeleteAnnotation((RTDeleteAnnotation)rto);
                }
                else if (rto is ArchiveRTNav.RTEraseLayer)
                {
                    ArchiveRTNav.RTEraseLayer rtel = (RTEraseLayer)rto;
                    BufferChunk bc = new BufferChunk(Helpers.ObjectToByteArray(rtel));
                    enqueueMain(new WorkItem(bc, PacketType.ClearScribble, rtel.SlideIndex, rtel.DeckGuid));
                }
                else if (rto is ArchiveRTNav.RTQuickPoll)
                {
                    ArchiveRTNav.RTQuickPoll rtqp = (RTQuickPoll)rto;
                    BufferChunk bc = new BufferChunk(Helpers.ObjectToByteArray(rtqp));
                    enqueueMain(new WorkItem(bc, PacketType.RTQuickPoll, rtqp.SlideIndex, rtqp.DeckGuid));
                }
                else
                {
                    Debug.WriteLine("CP3Manager returned unhandled archive type: " + rto.GetType().ToString());
                }
            }
        }