Exemple #1
0
        public void CopyInto(Slide newSlide)
        {
            var idMap = new Dictionary<int, int>();
            InkCanvas canvas = DesignerMainWindow.GetInstance().canMainCanvas;
            newSlide.Background = Background;

            // copy all slide objects with actions
            foreach (IObject slideObject in SlideObjects)
            {
                IObject newSlideObject = slideObject.DeepCopy();
                idMap.Add(slideObject.ObjectId, newSlideObject.ObjectId);
                canvas.CopyObjectPositionOnCanvas(newSlideObject, slideObject);
                newSlide.AddObject(newSlideObject);

                var interactive = slideObject as IInteractive;
                if (interactive == null) continue;

                (newSlideObject as IInteractive).Actions = interactive.CopyActionsForSlideCopy();
            }

            // change actions - should refer to new objects
            foreach (IObject slideObject in newSlide.SlideObjects)
            {
                var interactive = slideObject as IInteractive;
                if (interactive == null) continue;

                foreach (ComAction action in interactive.Actions)
                    action.ChangeReferingObjectId(idMap);
            }
        }
 public static Slide CreateEmptySlide()
 {
     var slide = new Slide
         {
             SlideId = _slideIDcounter++,
             SlideObjects = new List<IObject>(),
             Background = Practice.GetInstance().GetDefaultBackground(),
             IsSwitchable = true,
             SuperAction = null
         };
     return slide;
 }
Exemple #3
0
 public void ChangeSlideBackground(Slide slide, Brush bckgrnd)
 {
     LinkedListNode<Slide> linkedListNode = _slides.Find(slide);
     if (linkedListNode != null) linkedListNode.Value.Background = bckgrnd;
 }
Exemple #4
0
 public void DeleteSlide(Slide slide)
 {
     _slides.Remove(slide);
 }
Exemple #5
0
 public void AddNewSlide(Slide previousSlide, Slide newSlide)
 {
     _slides.AddAfter(_slides.Find(previousSlide), newSlide);
 }
Exemple #6
0
 public void AddNewSlide(Slide newSlide)
 {
     _slides.AddLast(newSlide);
 }
Exemple #7
0
 public Slide GetNextSlide(Slide currentSlide)
 {
     LinkedListNode<Slide> currentSlideNode = _slides.Find(currentSlide);
     if (_slides.Last.Equals(currentSlideNode))
         throw new Exception("Next slide doesn't exist!");
     return currentSlideNode.Next.Value;
 }
Exemple #8
0
 public Slide GetPreviousSlide(Slide currentSlide)
 {
     LinkedListNode<Slide> currentSlideNode = _slides.Find(currentSlide);
     if (_slides.First.Equals(currentSlideNode))
         throw new Exception("Previous slide doesn't exist!");
     return currentSlideNode.Previous.Value;
 }
Exemple #9
0
 public void ReplaceSlides(Slide newSlide, Slide originalSlide)
 {
     LinkedListNode<Slide> originalSlideNode = _slides.Find(originalSlide);
     if (originalSlideNode == null) return;
     ;
     _slides.AddAfter(originalSlideNode, newSlide);
     _slides.Remove(originalSlide);
 }
Exemple #10
0
        private XmlElement writeSlideDescription(Slide slide, List<Slide> slides, XmlDocument indexFile)
        {
            string previous;
            string next;
            Slide[] slideArray = slides.ToArray();

            previous = slides.IndexOf(slide) > 0 ? slideArray[slides.IndexOf(slide) - 1].SlideId.ToString() : "";
            next = slides.IndexOf(slide) < slides.Count() - 1
                       ? slideArray[slides.IndexOf(slide) + 1].SlideId.ToString()
                       : "";

            XmlElement slideDescription = indexFile.CreateElement("slide");
            slideDescription.SetAttribute("slideID", slide.SlideId.ToString());
            slideDescription.SetAttribute("previousSlide", previous);
            slideDescription.SetAttribute("nextSlide", next);
            slideDescription.SetAttribute("backgroundColor", Utilities.ConvertBrushToHex(slide.Background));
            slideDescription.SetAttribute("backgroundOpacity", slide.Background.Opacity.ToString());
            slideDescription.SetAttribute("isSwitchable", slide.IsSwitchable.ToString());

            return slideDescription;
        }