Esempio n. 1
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;
        }
Esempio n. 2
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;
 }
                public BkgTemplateSelectionComboBox(BackgroundPropertiesForm form, Point location, Size size, int tabIndex)
                {
                    this.m_Form = form;

                    this.SuspendLayout();
                    this.Location = location;
                    this.Size = size;
                    this.TabIndex = tabIndex;
                    this.FlatStyle = FlatStyle.System;

                    this.DropDownStyle = ComboBoxStyle.DropDownList;

                    this.Items.Clear();

                    int initialSelect=-1;

                    //Add the templates from xml file into the list
                    using (BackgroundTemplateXmlService service = new BackgroundTemplateXmlService(this.m_Form.m_Model.ViewerState))
                    {
                        ArrayList templates=new ArrayList ();
                        service.GetTemplates(templates);
                        for (int i = 0; i < templates.Count; i++)
                        {
                            this.Items.Add(templates[i]);
                            if (this.m_Form.m_Template != null && this.m_Form.m_Template.Name != null && this.m_Form.m_Template.Name.Equals(((BackgroundTemplate)templates[i]).Name))
                                initialSelect = i;
                        }
                    }

                    //if the current deck/slide template is not in the xml file,
                    if (this.m_Form.m_Template != null && initialSelect == -1)
                    {
                        this.Items.Add(m_Form.m_Template.Clone());
                        initialSelect = this.Items.Count - 1;
                    }

                    //Add no background template selection
                    this.Items.Add(Strings.NoBackgroundTemplate);
                    if (this.m_Form.m_Template == null)
                        initialSelect = this.Items.Count - 1;

                    this.SelectedIndex = initialSelect;

                    this.ResumeLayout();
                }