Пример #1
0
 public static Message ForSheet(SheetModel sheet, SheetCollection collection)
 {
     if (sheet is ImageSheetModel) {
         //If it's an instructor note, return null.
         if (sheet.Disposition == SheetDisposition.Instructor)
             return null;
         else
             return new ImageSheetMessage((ImageSheetModel)sheet, collection);
     }
     if(sheet is RealTimeInkSheetModel)
         return new RealTimeInkSheetInformationMessage((RealTimeInkSheetModel) sheet, collection);
     if(sheet is InkSheetModel)
         return new InkSheetInformationMessage((InkSheetModel) sheet, collection);
     if(sheet is TextSheetModel)
         return new TextSheetMessage((TextSheetModel) sheet, collection);
     if( sheet is QuickPollSheetModel ) {
         Message poll;
         using( Synchronizer.Lock( sheet.SyncRoot ) ) {
             poll = new QuickPollInformationMessage( ((QuickPollSheetModel)sheet).QuickPoll );
         }
         poll.InsertChild( new QuickPollSheetMessage( (QuickPollSheetModel)sheet, collection ) );
         return poll;
     }
     throw new ArgumentException("Unknown sheet type: " + sheet.GetType().ToString());
 }
        /// <summary>
        /// Send a QuickPollResultInformationMessage to the appropriate receivers
        /// </summary>
        /// <param name="receivers">The group of people that should receive the update</param>
        private void SendResultChanged(Group receivers)
        {
            Message message, poll, res;

            message       = new PresentationInformationMessage(this.m_Presentation);
            message.Group = receivers;
            poll          = new QuickPollInformationMessage(this.m_QuickPoll);
            poll.Group    = receivers;
            message.InsertChild(poll);
            res       = new QuickPollResultInformationMessage(this.m_Result);
            res.Group = receivers;
            poll.InsertChild(res);
            this.m_Sender.Send(message);
        }
 private void SendQuickPollSheetHelper( Group receivers )
 {
     //Don't send message if it's an instructor note.
     if( this.sheet.Disposition != SheetDisposition.Instructor ) {
         Message message, deck, poll, slide;
         message = new PresentationInformationMessage( this.Presentation );
         message.Group = receivers;
         message.InsertChild( deck = new DeckInformationMessage( this.Deck ) );
         deck.InsertChild( slide = new SlideInformationMessage( this.Slide ) );
         using( Synchronizer.Lock( this.Sheet.SyncRoot ) ) {
             slide.InsertChild( poll = new QuickPollInformationMessage( this.sheet.QuickPoll ) );
         }
         poll.InsertChild( new QuickPollSheetMessage( this.sheet, this.SheetCollectionSelector ) );
         using( Synchronizer.Lock( m_SlideModel.SyncRoot ) ) {
             message.Tags = new MessageTags();
             message.Tags.SlideID = m_SlideModel.Id;
         }
         this.Sender.Send( message );
     }
 }
Пример #4
0
 public static Message ForSheet(SheetModel sheet, SheetCollection collection)
 {
     if (sheet is ImageSheetModel)
     {
         //If it's an instructor note, return null.
         if (sheet.Disposition == SheetDisposition.Instructor)
         {
             return(null);
         }
         else
         {
             return(new ImageSheetMessage((ImageSheetModel)sheet, collection));
         }
     }
     if (sheet is RealTimeInkSheetModel)
     {
         return(new RealTimeInkSheetInformationMessage((RealTimeInkSheetModel)sheet, collection));
     }
     if (sheet is InkSheetModel)
     {
         return(new InkSheetInformationMessage((InkSheetModel)sheet, collection));
     }
     if (sheet is TextSheetModel)
     {
         return(new TextSheetMessage((TextSheetModel)sheet, collection));
     }
     if (sheet is QuickPollSheetModel)
     {
         Message poll;
         using (Synchronizer.Lock(sheet.SyncRoot)) {
             poll = new QuickPollInformationMessage(((QuickPollSheetModel)sheet).QuickPoll);
         }
         poll.InsertChild(new QuickPollSheetMessage((QuickPollSheetModel)sheet, collection));
         return(poll);
     }
     if (sheet is XPSPageSheetModel)
     {
         return(new XPSPageSheetMessage((XPSPageSheetModel)sheet, collection));
     }
     throw new ArgumentException("Unknown sheet type: " + sheet.GetType().ToString());
 }
 private void SendQuickPollSheetHelper(Group receivers)
 {
     //Don't send message if it's an instructor note.
     if (this.sheet.Disposition != SheetDisposition.Instructor)
     {
         Message message, deck, poll, slide;
         message                  = new PresentationInformationMessage(this.Presentation);
         message.Group            = receivers;
         message.InsertChild(deck = new DeckInformationMessage(this.Deck));
         deck.InsertChild(slide   = new SlideInformationMessage(this.Slide));
         using (Synchronizer.Lock(this.Sheet.SyncRoot)) {
             slide.InsertChild(poll = new QuickPollInformationMessage(this.sheet.QuickPoll));
         }
         poll.InsertChild(new QuickPollSheetMessage(this.sheet, this.SheetCollectionSelector));
         using (Synchronizer.Lock(m_SlideModel.SyncRoot)) {
             message.Tags         = new MessageTags();
             message.Tags.SlideID = m_SlideModel.Id;
         }
         this.Sender.Send(message);
     }
 }
Пример #6
0
        /// <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);
        }
Пример #7
0
        /// <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);
        }
            private void SendPollResultInformation( QuickPollResultModel result, Group receivers )
            {
                Message message, poll, res;
                message = new PresentationInformationMessage( this.m_Service.m_Presentation );
                message.Group = receivers;
                poll = new QuickPollInformationMessage( this.m_Service.m_QuickPoll );
                poll.Group = receivers;
                message.InsertChild( poll );
                res = new QuickPollResultInformationMessage( result );
                res.Group = receivers;
                poll.InsertChild( res );

                this.m_Service.m_Sender.Send( message );
            }