Ejemplo n.º 1
0
        /// <summary>
        /// This is similar to the texthelpermethod, but here we send a removal message
        /// if the message is private. I am having two different methods for the sake of seperating
        /// the two different types of messages.
        /// </summary>
        /// <param name="receivers"></param>
        private void SendPublicHelper(Group receivers)
        {
            Message message, deck, slide;

            message                  = new PresentationInformationMessage(this.Presentation);
            message.Group            = receivers;
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(this.Slide));

            ///send the text message
            bool sheet_is_public;

            using (Synchronizer.Lock(sheet_.SyncRoot)) {
                sheet_is_public = sheet_.IsPublic;
            }
            ///if the sheet is private, the users should not be able to see any part of the sheet,
            ///so we should just remove a private sheet.
            if (sheet_is_public)
            {
                slide.InsertChild(new TextSheetMessage(this.sheet_, this.SheetCollectionSelector));
            }
            else
            {
                slide.InsertChild(new SheetRemovedMessage(this.sheet_, this.SheetCollectionSelector));
            }

            using (Synchronizer.Lock(this.Slide.SyncRoot)) {
                message.Tags         = new MessageTags();
                message.Tags.SlideID = this.Slide.Id;
            }

            this.Sender.Send(message);
        }
Ejemplo n.º 2
0
        public void SendSheetInformation(SheetModel sheet, SheetMessage.SheetCollection selector, Group receivers)
        {
            // TODO: Also pass the index so the sheet can be inserted into the correct index on the remote side.
            Message message, deck, slide;

            message                  = new PresentationInformationMessage(this.m_Presentation);
            message.Group            = receivers;
            message.InsertChild(deck = new DeckInformationMessage(this.m_Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(this.m_Slide));
            Message sm = SheetMessage.RemoteForSheet(sheet, selector);

            //if sm is null that means that the sheet is an instructor note and shouldn't be sent.
            if (sm != null)
            {
                slide.InsertChild(sm);
            }
            using (Synchronizer.Lock(this.m_Slide.SyncRoot)) {
                message.Tags         = new MessageTags();
                message.Tags.SlideID = this.m_Slide.Id;
            }
            if (sheet is ImageSheetModel && ((ImageSheetModel)sheet).Image != null)
            {
                using (Synchronizer.Lock(sheet.SyncRoot)) {
                    this.m_Sender.Send(message);
                }
            }
            else
            {
                this.m_Sender.Send(message);
            }
        }
Ejemplo n.º 3
0
            protected override void TearDownMember(int index, object member, object tag)
            {
                if (tag == null)
                {
                    return;
                }

                SheetModel sheet = ((SheetModel)member);

                Message message, deck, slide;

                message = new PresentationInformationMessage(this.m_Service.m_Presentation);
                message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
                deck.InsertChild(slide   = new SlideInformationMessage(this.m_Service.m_Slide));
                slide.InsertChild(new SheetRemovedMessage(sheet, this.m_Selector));

                using (Synchronizer.Lock(this.m_Service.m_Slide.SyncRoot)) {
                    message.Tags         = new MessageTags();
                    message.Tags.SlideID = this.m_Service.m_Slide.Id;
                }

                this.m_Service.m_Sender.Send(message);

                ((SheetNetworkService)tag).Dispose();
            }
Ejemplo n.º 4
0
 private void SendImageHelper(Group receivers)
 {
     //Don't send message if it's an instructor note.
     if (this.sheet_.Disposition != SheetDisposition.Instructor)
     {
         Message message, deck, slide;
         message                  = new PresentationInformationMessage(this.Presentation);
         message.Group            = receivers;
         message.InsertChild(deck = new DeckInformationMessage(this.Deck));
         deck.InsertChild(slide   = new SlideInformationMessage(this.Slide));
         slide.InsertChild(new ImageSheetMessage(this.sheet_, this.SheetCollectionSelector));
         using (Synchronizer.Lock(m_SlideModel.SyncRoot)) {
             message.Tags         = new MessageTags();
             message.Tags.SlideID = m_SlideModel.Id;
         }
         if (this.sheet_.Image != null)
         {
             using (Synchronizer.Lock(this.sheet_.SyncRoot)) {
                 this.Sender.Send(message);
             }
         }
         else
         {
             this.Sender.Send(message);
         }
     }
 }
Ejemplo n.º 5
0
        private void HandleInkDeletingHelper(string[] ids)
        {
            Message message, deck, slide, sheet;

            message = new PresentationInformationMessage(this.Presentation);
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(GetSubmissionSlideModel(), false));
            slide.InsertChild(sheet  = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids));
            this.Sender.Send(message);
        }
        private void HandleCurrentDrawingAttributesChanged(object sender, PropertyEventArgs args)
        {
            Message message, deck, slide, sheet;

            message = new PresentationInformationMessage(this.Presentation);
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(GetSubmissionSlideModel(), false));
            slide.InsertChild(sheet  = SheetMessage.RemoteForSheet(this.Sheet, this.SheetCollectionSelector));
            this.Sender.Send(message);
        }
Ejemplo n.º 7
0
        private void HandleInkAddedHelper(Ink extracted)
        {
            Message message, deck, slide, sheet;

            message = new PresentationInformationMessage(this.Presentation);
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(GetSubmissionSlideModel(), false));
            slide.InsertChild(sheet  = new InkSheetStrokesAddedMessage(this.m_Sheet, (Guid)slide.TargetId, this.SheetCollectionSelector, extracted));
            sheet.AddOldestPredecessor(SheetMessage.RemoteForSheet(this.m_Sheet, this.SheetCollectionSelector));
            this.Sender.Send(message);
        }
Ejemplo n.º 8
0
            private void SendEntryAdded(TableOfContentsModel.Entry entry, Group receivers)
            {
                Message message, deck, slide;

                message                  = new PresentationInformationMessage(this.m_Service.m_Presentation);
                message.Group            = receivers;
                message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
                deck.InsertChild(slide   = new SlideInformationMessage(entry.Slide));
                slide.InsertChild(new TableOfContentsEntryMessage(entry));
                this.m_Service.m_Sender.Send(message);
            }
Ejemplo n.º 9
0
        private void HandleInkDeletingHelper(string[] ids)
        {
            Message message, deck, slide, sheet;

            message = new PresentationInformationMessage(this.Presentation);
            message.InsertChild(deck    = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide      = new SlideInformationMessage(this.Slide));
            slide.InsertChild(sheet     = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids));
            message.Tags                = new MessageTags();
            message.Tags.SlideID        = m_SlideID;
            message.Tags.BridgePriority = MessagePriority.Higher;
            this.Sender.Send(message);
        }
Ejemplo n.º 10
0
        protected virtual void HandleBoundsChanged(object sender, PropertyEventArgs args)
        {
            // Send a generic update with information about the sheet (including the new bounds).
            Message message, deck, slide, sheet;

            message = new PresentationInformationMessage(this.Presentation);
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(this.Slide));
            slide.InsertChild(sheet  = SheetMessage.RemoteForSheet(this.Sheet, this.SheetCollectionSelector));
            using (Synchronizer.Lock(this.m_Slide.SyncRoot)) {
                message.Tags         = new MessageTags();
                message.Tags.SlideID = this.m_Slide.Id;
            }
            this.Sender.Send(message);
        }
Ejemplo n.º 11
0
            protected override void TearDownMember(int index, object member, object tag)
            {
                if (tag == null)
                {
                    return;
                }

                TableOfContentsModel.Entry entry = ((TableOfContentsModel.Entry)member);

                Message message, deck, slide;

                message = new PresentationInformationMessage(this.m_Service.m_Presentation);
                message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
                deck.InsertChild(slide   = new SlideInformationMessage(entry.Slide));
                slide.InsertChild(new TableOfContentsEntryRemovedMessage(entry));

                this.m_Service.m_Sender.Send(message);
            }
Ejemplo n.º 12
0
        private void SendTextHelper(Group receivers)
        {
            Message message, deck, slide;

            message                  = new PresentationInformationMessage(this.Presentation);
            message.Group            = receivers;
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide   = new SlideInformationMessage(this.Slide));

            ///send the text message
            slide.InsertChild(new TextSheetMessage(this.sheet_, this.SheetCollectionSelector));

            using (Synchronizer.Lock(this.Slide.SyncRoot)) {
                message.Tags         = new MessageTags();
                message.Tags.SlideID = this.Slide.Id;
            }

            this.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 );
     }
 }
 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);
     }
 }
 private void SendImageHelper(Group receivers)
 {
     //Don't send message if it's an instructor note.
     if (this.sheet_.Disposition != SheetDisposition.Instructor) {
         Message message, deck, slide;
         message = new PresentationInformationMessage(this.Presentation);
         message.Group = receivers;
         message.InsertChild(deck = new DeckInformationMessage(this.Deck));
         deck.InsertChild(slide = new SlideInformationMessage(this.Slide));
         slide.InsertChild(new ImageSheetMessage(this.sheet_, this.SheetCollectionSelector));
         using (Synchronizer.Lock(m_SlideModel.SyncRoot)) {
             message.Tags = new MessageTags();
             message.Tags.SlideID = m_SlideModel.Id;
         }
         if (this.sheet_.Image != null) {
             using (Synchronizer.Lock(this.sheet_.SyncRoot)) {
                 this.Sender.Send(message);
             }
         }
         else
             this.Sender.Send(message);
     }
 }
Ejemplo n.º 16
0
 public void SendSheetInformation( SheetModel sheet, SheetMessage.SheetCollection selector, Group receivers )
 {
     // TODO: Also pass the index so the sheet can be inserted into the correct index on the remote side.
     Message message, deck, slide;
     message = new PresentationInformationMessage( this.m_Presentation );
     message.Group = receivers;
     message.InsertChild( deck = new DeckInformationMessage( this.m_Deck ) );
     deck.InsertChild( slide = new SlideInformationMessage( this.m_Slide ) );
     Message sm = SheetMessage.RemoteForSheet(sheet, selector);
     //if sm is null that means that the sheet is an instructor note and shouldn't be sent.
     if (sm != null) {
         slide.InsertChild(sm);
     }
     using( Synchronizer.Lock( this.m_Slide.SyncRoot ) ) {
         message.Tags = new MessageTags();
         message.Tags.SlideID = this.m_Slide.Id;
     }
     if (sheet is ImageSheetModel && ((ImageSheetModel)sheet).Image != null) {
         using (Synchronizer.Lock(sheet.SyncRoot)) {
             this.m_Sender.Send( message );
         }
     }
     else
         this.m_Sender.Send(message);
 }
 private void HandleCurrentDrawingAttributesChanged(object sender, PropertyEventArgs args)
 {
     Message message, deck, slide, sheet;
     message = new PresentationInformationMessage(this.Presentation);
     message.InsertChild(deck = new DeckInformationMessage(this.Deck));
     deck.InsertChild(slide = new SlideInformationMessage(this.Slide));
     slide.InsertChild( sheet = SheetMessage.RemoteForSheet( this.Sheet, this.SheetCollectionSelector ) );
     message.Tags = new MessageTags();
     message.Tags.SlideID = m_SlideID;
     this.Sender.Send(message);
 }
Ejemplo n.º 18
0
 protected virtual void HandleBoundsChanged(object sender, PropertyEventArgs args)
 {
     // Send a generic update with information about the sheet (including the new bounds).
     Message message, deck, slide, sheet;
     message = new PresentationInformationMessage(this.Presentation);
     message.InsertChild(deck = new DeckInformationMessage(this.Deck));
     deck.InsertChild(slide = new SlideInformationMessage(this.Slide));
     slide.InsertChild( sheet = SheetMessage.RemoteForSheet( this.Sheet, this.SheetCollectionSelector ) );
     using (Synchronizer.Lock(this.m_Slide.SyncRoot)) {
         message.Tags = new MessageTags();
         message.Tags.SlideID = this.m_Slide.Id;
     }
     this.Sender.Send(message);
 }
Ejemplo n.º 19
0
            protected override void TearDownMember(int index, object member, object tag)
            {
                if(tag == null) return;

                SheetModel sheet = ((SheetModel) member);

                Message message, deck, slide;
                message = new PresentationInformationMessage(this.m_Service.m_Presentation);
                message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
                deck.InsertChild(slide = new SlideInformationMessage(this.m_Service.m_Slide));
                slide.InsertChild(new SheetRemovedMessage(sheet, this.m_Selector));

                using (Synchronizer.Lock(this.m_Service.m_Slide.SyncRoot)) {
                    message.Tags = new MessageTags();
                    message.Tags.SlideID = this.m_Service.m_Slide.Id;
                }

                this.m_Service.m_Sender.Send(message);

                ((SheetNetworkService) tag).Dispose();
            }
        /// <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);
                }
            }
        }
        private void SendTextHelper(Group receivers)
        {
            Message message, deck, slide;
            message = new PresentationInformationMessage(this.Presentation);
            message.Group = receivers;
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide = new SlideInformationMessage(this.Slide));

            ///send the text message
            slide.InsertChild(new TextSheetMessage(this.sheet_, this.SheetCollectionSelector));

            using (Synchronizer.Lock(this.Slide.SyncRoot)) {
                message.Tags = new MessageTags();
                message.Tags.SlideID = this.Slide.Id;
            }

            this.Sender.Send(message);
        }
 private void SendEntryAdded(TableOfContentsModel.Entry entry, Group receivers)
 {
     Message message, deck, slide;
     message = new PresentationInformationMessage(this.m_Service.m_Presentation);
     message.Group = receivers;
     message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
     deck.InsertChild(slide = new SlideInformationMessage(entry.Slide));
     slide.InsertChild(new TableOfContentsEntryMessage(entry));
     this.m_Service.m_Sender.Send(message);
 }
            protected override void TearDownMember(int index, object member, object tag)
            {
                if(tag == null) return;

                TableOfContentsModel.Entry entry = ((TableOfContentsModel.Entry) member);

                Message message, deck, slide;
                message = new PresentationInformationMessage(this.m_Service.m_Presentation);
                message.InsertChild(deck = new DeckInformationMessage(this.m_Service.m_Deck));
                deck.InsertChild(slide = new SlideInformationMessage(entry.Slide));
                slide.InsertChild(new TableOfContentsEntryRemovedMessage(entry));

                this.m_Service.m_Sender.Send(message);
            }
 private void HandleInkDeletingHelper(string[] ids)
 {
     Message message, deck, slide, sheet;
     message = new PresentationInformationMessage(this.Presentation);
     message.InsertChild(deck = new DeckInformationMessage(this.Deck));
     deck.InsertChild(slide = new SlideInformationMessage(this.Slide));
     slide.InsertChild(sheet = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids));
     message.Tags = new MessageTags();
     message.Tags.SlideID = m_SlideID;
     message.Tags.BridgePriority = MessagePriority.Higher;
     this.Sender.Send(message);
 }
 private void HandleInkDeletingHelper(string[] ids)
 {
     Message message, deck, slide, sheet;
     message = new PresentationInformationMessage(this.Presentation);
     message.InsertChild(deck = new DeckInformationMessage(this.Deck));
     deck.InsertChild(slide = new SlideInformationMessage( GetSubmissionSlideModel(), false ));
     slide.InsertChild(sheet = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids));
     this.Sender.Send(message);
 }
        /// <summary>
        /// This is similar to the texthelpermethod, but here we send a removal message
        /// if the message is private. I am having two different methods for the sake of seperating
        /// the two different types of messages.
        /// </summary>
        /// <param name="receivers"></param>
        private void SendPublicHelper(Group receivers)
        {
            Message message, deck, slide;
            message = new PresentationInformationMessage(this.Presentation);
            message.Group = receivers;
            message.InsertChild(deck = new DeckInformationMessage(this.Deck));
            deck.InsertChild(slide = new SlideInformationMessage(this.Slide));

            ///send the text message
            bool sheet_is_public;
            using (Synchronizer.Lock(sheet_.SyncRoot)) {
                sheet_is_public = sheet_.IsPublic;
            }
            ///if the sheet is private, the users should not be able to see any part of the sheet,
            ///so we should just remove a private sheet.
            if (sheet_is_public) {
                slide.InsertChild(new TextSheetMessage(this.sheet_, this.SheetCollectionSelector));
            } else {
                slide.InsertChild(new SheetRemovedMessage(this.sheet_, this.SheetCollectionSelector));
            }

            using (Synchronizer.Lock(this.Slide.SyncRoot)) {
                message.Tags = new MessageTags();
                message.Tags.SlideID = this.Slide.Id;
            }

            this.Sender.Send(message);
        }
 private void HandleInkAddedHelper(Ink extracted)
 {
     Message message, deck, slide, sheet;
     message = new PresentationInformationMessage(this.Presentation);
     message.InsertChild(deck = new DeckInformationMessage(this.Deck));
     deck.InsertChild(slide = new SlideInformationMessage( GetSubmissionSlideModel(), false ));
     slide.InsertChild(sheet = new InkSheetStrokesAddedMessage(this.m_Sheet, (Guid)slide.TargetId, this.SheetCollectionSelector, extracted));
     sheet.AddOldestPredecessor( SheetMessage.RemoteForSheet( this.m_Sheet, this.SheetCollectionSelector ) );
     this.Sender.Send(message);
 }