Пример #1
0
        // There is no event for SlideContentDeleted.  Since content is only removed
        // when slides are removed, the SlideRemoved event is all that's necessary.

        #endregion

        #region Slide/Content Editing

        /// <summary>
        /// Retrieves a slide with a specific ID
        /// </summary>
        /// <param name="slideHash">The ID of the slide to get</param>
        /// <returns>A slide model object for the slide with the given ID</returns>
        public SlideModel GetSlide(LocalId slideHash)
        {
            Synchronizer.AssertLockIsHeld(this.SyncRoot);

            if (this.m_Slides.Contains(slideHash))
            {
                return((SlideModel)this.m_Slides[slideHash]);
            }
            else
            {
                //TODO: Do we want to return null here?
                return(null);
            }
        }
Пример #2
0
 public SlideModel(Guid id, LocalId localId, SlideDisposition disposition, Rectangle bounds)
 {
     this.m_Id = id;
     this.m_LocalId = localId;
     this.m_Disposition = disposition;
     this.m_ContentSheets = new SheetCollection(this, "ContentSheets");
     this.m_AnnotationSheets = new SheetCollection(this, "AnnotationSheets");
     this.m_Bounds = bounds;
     this.m_Title = "";
     this.m_Zoom = 1f;
     this.m_BackgroundColor = Color.Empty;
     this.m_SubmissionSlideGuid = Guid.Empty;
     this.m_SubmissionStyle = StudentSubmissionStyle.Normal;
 }
Пример #3
0
 public SlideModel(Guid id, LocalId localId, SlideDisposition disposition, Rectangle bounds)
 {
     this.m_Id                  = id;
     this.m_LocalId             = localId;
     this.m_Disposition         = disposition;
     this.m_ContentSheets       = new SheetCollection(this, "ContentSheets");
     this.m_AnnotationSheets    = new SheetCollection(this, "AnnotationSheets");
     this.m_Bounds              = bounds;
     this.m_Title               = "";
     this.m_Zoom                = 1f;
     this.m_BackgroundColor     = Color.Empty;
     this.m_SubmissionSlideGuid = Guid.Empty;
     this.m_SubmissionStyle     = StudentSubmissionStyle.Normal;
     this.m_Visited             = false;
 }
Пример #4
0
        public SlideModel(Guid id, LocalId localId, SlideDisposition disposition, Rectangle bounds, Guid associationId)
            : this(id, localId, disposition, bounds)
        {
            this.m_AssociationId = associationId;

            //If this is a student submission, the associationID should be set.  In this case we
            //gather some extra information about the association slide and deck.
            if (!m_AssociationId.Equals(Guid.Empty))
            {
                PresentationModel pres = PresentationModel.CurrentPresentation;
                if (pres != null)
                {
                    PresentationModel.DeckTraversalCollection traversals;
                    traversals = pres.DeckTraversals;
                    foreach (DeckTraversalModel dtm in traversals)
                    {
                        DeckModel deck;
                        using (Synchronizer.Lock(dtm.SyncRoot)) {
                            deck = dtm.Deck;
                        }
                        Guid                 deckId;
                        DeckDisposition      deckDisp;
                        TableOfContentsModel toc;
                        using (Synchronizer.Lock(deck.SyncRoot)) {
                            deckId   = deck.Id;
                            deckDisp = deck.Disposition;
                            toc      = deck.TableOfContents;
                        }
                        TableOfContentsModel.Entry tocEntry = toc.GetEntryBySlideId(m_AssociationId);
                        if (tocEntry != null)
                        {
                            using (Synchronizer.Lock(tocEntry.SyncRoot)) {
                                m_AssociationSlideIndex = tocEntry.IndexInParent;
                            }
                            m_AssociationDeckDispostion = deckDisp;
                            m_AssociationDeckId         = deckId;
                            break;
                        }
                    }
                }
            }
        }
Пример #5
0
        public SlideModel(Guid id, LocalId localId, SlideDisposition disposition, Rectangle bounds, Guid associationId)
            : this(id, localId, disposition, bounds)
        {
            this.m_AssociationId = associationId;

            //If this is a student submission, the associationID should be set.  In this case we
            //gather some extra information about the association slide and deck.
            if (!m_AssociationId.Equals(Guid.Empty)) {
                PresentationModel pres = PresentationModel.CurrentPresentation;
                if (pres != null) {
                    PresentationModel.DeckTraversalCollection traversals;
                    using (Synchronizer.Lock(pres.SyncRoot)) {
                        traversals = PresentationModel.CurrentPresentation.DeckTraversals;
                    }
                    foreach (DeckTraversalModel dtm in traversals) {
                        DeckModel deck;
                        using (Synchronizer.Lock(dtm.SyncRoot)) {
                            deck = dtm.Deck;
                        }
                        Guid deckId;
                        DeckDisposition deckDisp;
                        TableOfContentsModel toc;
                        using (Synchronizer.Lock(deck.SyncRoot)) {
                            deckId = deck.Id;
                            deckDisp = deck.Disposition;
                            toc = deck.TableOfContents;
                        }
                        TableOfContentsModel.Entry tocEntry = toc.GetEntryBySlideId(m_AssociationId);
                        if (tocEntry != null) {
                            using (Synchronizer.Lock(tocEntry.SyncRoot)) {
                                m_AssociationSlideIndex = tocEntry.IndexInParent;
                            }
                            m_AssociationDeckDispostion = deckDisp;
                            m_AssociationDeckId = deckId;
                            break;
                        }
                    }
                }
            }
        }
Пример #6
0
 public SlideModel(Guid id, LocalId localId, SlideDisposition disposition) : this(id, localId, disposition, Rectangle.Empty)
 {
 }
Пример #7
0
        /// <summary>
        /// Retrieves a slide with a specific ID
        /// </summary>
        /// <param name="slideHash">The ID of the slide to get</param>
        /// <returns>A slide model object for the slide with the given ID</returns>
        public SlideModel GetSlide(LocalId slideHash)
        {
            Synchronizer.AssertLockIsHeld(this.SyncRoot);

            if (this.m_Slides.Contains(slideHash)) {
                return (SlideModel)this.m_Slides[slideHash];
            } else {
                //TODO: Do we want to return null here?
                return null;
            }
        }
Пример #8
0
 public SlideMessage( SlideModel slide, bool localRef )
     : base(slide.Id)
 {
     if( localRef )
         this.AddLocalRef( slide );
     this.LocalId = slide.LocalId;
     using( Synchronizer.Lock( slide.SyncRoot ) ) {
         this.Zoom = slide.Zoom;
         this.Bounds = slide.Bounds;
         this.Title = slide.Title;
         this.SlideBackgroundColor = slide.BackgroundColor;
         this.SubmissionSlideGuid = slide.SubmissionSlideGuid;
         this.SubmissionStyle = slide.SubmissionStyle;
         this.AssociationSlideId = slide.AssociationId;
         if (!this.AssociationSlideId.Equals(Guid.Empty)) {
             AddAssociationExtension(slide);
         }
     }
 }
Пример #9
0
 public SlideMessage( Message parent, SerializedPacket p )
     : base(parent, p)
 {
     this.LocalId = (!SerializedPacket.IsNullPacket( p.PeekNextPart() )) ?
         new LocalId( p.PeekNextPart() ) : null; p.GetNextPart();
     this.Title = SerializedPacket.DeserializeString( p.GetNextPart() );
     this.Zoom = SerializedPacket.DeserializeFloat( p.GetNextPart() );
     this.Bounds = SerializedPacket.DeserializeRectangle( p.GetNextPart() );
     this.SlideBackgroundColor = SerializedPacket.DeserializeColor( p.GetNextPart() );
     this.SubmissionSlideGuid = SerializedPacket.DeserializeGuid( p.GetNextPart() );
     this.SubmissionStyle = (SlideModel.StudentSubmissionStyle)SerializedPacket.DeserializeLong( p.GetNextPart() );
     this.Disposition = (SlideDisposition)SerializedPacket.DeserializeLong( p.GetNextPart() );
     this.AssociationSlideId = SerializedPacket.DeserializeGuid( p.GetNextPart() );
 }
Пример #10
0
 public SlideModel(Guid id, LocalId localId, SlideDisposition disposition)
     : this(id, localId, disposition, Rectangle.Empty)
 {
 }