Example #1
0
        protected override bool UpdateTarget(ReceiveContext context)
        {
            DeckModel deck = this.Target as DeckModel;

            if (deck == null)
            {
                this.Target = deck = new DeckModel(((Guid)this.TargetId), this.Disposition | DeckDisposition.Remote, this.HumanName);
            }
            else
            {
                using (Synchronizer.Lock(deck.SyncRoot)) {
                    deck.HumanName = this.HumanName;
                }
            }
            if ((this.Disposition & DeckDisposition.Remote) == 0)
            {
                using (Synchronizer.Lock(deck.SyncRoot)) {
                    deck.DeckBackgroundColor    = this.DeckBackgroundColor;
                    deck.DeckBackgroundTemplate = this.DeckBackgroundTemplate;
                }
                //if the background template is not exist in BackgroundTemplate.xml, then save it to the xml file
                if (this.DeckBackgroundTemplate != null)
                {
                    BackgroundTemplateXmlService xmlservice = new BackgroundTemplateXmlService();
                    if (!xmlservice.IsTemplateExist(this.DeckBackgroundTemplate.Name))
                    {
                        xmlservice.SaveTemplate(this.DeckBackgroundTemplate);
                    }
                }
            }
            return(true);
        }
Example #2
0
        protected override bool UpdateTarget(ReceiveContext context)
        {
            SlideModel slide = this.Target as SlideModel;

            if (slide == null)
            {
                this.Target = slide = new SlideModel(((Guid)this.TargetId), this.LocalId, this.Disposition | SlideDisposition.Remote, this.Bounds);
            }

            using (Synchronizer.Lock(slide.SyncRoot)) {
                slide.Title              = this.Title;
                slide.Bounds             = this.Bounds;
                slide.Zoom               = this.Zoom;
                slide.BackgroundColor    = this.SlideBackgroundColor;
                slide.BackgroundTemplate = this.SlideBackgroundTemplate;
                //Force the FilmStrip refresh, when slide.Visited change from false to true.
                if (slide.Visited == false && this.Visited == true)
                {
                    slide.Visited = this.Visited;
                    using (Synchronizer.Lock(PresenterModel.TheInstance.ViewerState.SyncRoot)) {
                        if (PresenterModel.TheInstance.ViewerState.StudentNavigationType == LinkedDeckTraversalModel.NavigationSelector.Visited && PresenterModel.TheInstance.ViewerState.FilmStripEnabled == true)
                        {
                            PresenterModel.TheInstance.ViewerState.FilmStripEnabled = false;
                            PresenterModel.TheInstance.ViewerState.FilmStripEnabled = true;
                        }
                    }
                }
                slide.Visited             = this.Visited;
                slide.SubmissionSlideGuid = this.SubmissionSlideGuid;
                if (slide.SubmissionStyle != this.SubmissionStyle)
                {
                    slide.SubmissionStyle = this.SubmissionStyle;
                }
            }

            DeckModel deck = this.Parent != null ? this.Parent.Target as DeckModel : null;

            if (deck != null)
            {
                using (Synchronizer.Lock(deck.SyncRoot)) {
                    deck.InsertSlide(slide);
                }
            }

            //if the background template is not exist in BackgroundTemplate.xml, then save it to the xml file
            if (this.SlideBackgroundTemplate != null)
            {
                BackgroundTemplateXmlService xmlservice = new BackgroundTemplateXmlService();

                if (!xmlservice.IsTemplateExist(this.SlideBackgroundTemplate.Name))
                {
                    xmlservice.SaveTemplate(this.SlideBackgroundTemplate);
                }
            }
            return(true);
        }