public DeckSlideContentMessage(DeckModel deck, ByteArray hash)
            : base(hash)
        {
            using(Synchronizer.Lock(deck.SyncRoot)) {
                Image image = deck.GetSlideContent(hash);

                if(image == null)
                    throw new ArgumentException("The specified ByteArray does not map to slide content in the specified deck.", "hash");

                this.Target = this.Content = new ImageHashtable.ImageHashTableItem(hash, image);
                this.AddLocalRef( this.Target );
            }
        }
 public DeckSlideContentMessage( Message parent, SerializedPacket p )
     : base(parent, p)
 {
     this.Content = null;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Event handler that is invoked when a slide's content has changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args_"></param>
        private void HandleSlideContentAdded(object sender, PropertyEventArgs args_)
        {
            PropertyCollectionEventArgs args = ((PropertyCollectionEventArgs) args_);
            ByteArray hash = ((ByteArray) args.Added);

            ImageHashtable.ImageHashTableItem Content;

            // Get the slide content from the source deck
            using(Synchronizer.Lock(this.SourceDeck.SyncRoot)) {
                Image image = this.SourceDeck.GetSlideContent( hash );

                if( image == null )
                    throw new ArgumentException("The specified ByteArray does not map to slide content in the specified deck.", "hash");

                Content = new ImageHashtable.ImageHashTableItem( hash, image );
            }

            // Add the slide content to the destination deck
            using(Synchronizer.Lock(this.DestinationDeck.SyncRoot)) {
                // Note: If the deck already has content with this hash, nothing will happen.
                this.DestinationDeck.AddSlideContent( Content.key, Content.image );
            }
        }