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; }
public void ChangeSlideBackground(Slide slide, Brush bckgrnd) { LinkedListNode<Slide> linkedListNode = _slides.Find(slide); if (linkedListNode != null) linkedListNode.Value.Background = bckgrnd; }
public void DeleteSlide(Slide slide) { _slides.Remove(slide); }
public void AddNewSlide(Slide previousSlide, Slide newSlide) { _slides.AddAfter(_slides.Find(previousSlide), newSlide); }
public void AddNewSlide(Slide newSlide) { _slides.AddLast(newSlide); }
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; }
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; }
public void ReplaceSlides(Slide newSlide, Slide originalSlide) { LinkedListNode<Slide> originalSlideNode = _slides.Find(originalSlide); if (originalSlideNode == null) return; ; _slides.AddAfter(originalSlideNode, newSlide); _slides.Remove(originalSlide); }
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; }