private void AddSlideThumbnail(PowerPointSlide slide, int pos = -1, bool isCurrentSlide = false) { if (slide == null) { return; } var thumbnailPath = TempPath.GetPath("slide-" + DateTime.Now.GetHashCode() + slide.Index); slide.GetNativeSlide().Export(thumbnailPath, "JPG", GetPreviewWidth(), PreviewHeight); ImageItem imageItem; if (isCurrentSlide) { imageItem = new ImageItem { ImageFile = thumbnailPath, Tooltip = "(Current) Slide " + slide.Index }; } else { imageItem = new ImageItem { ImageFile = thumbnailPath, Tooltip = "Slide " + slide.Index }; } Dispatcher.Invoke(new Action(() => { if (pos == -1) { SlideList.Add(imageItem); } else { SlideList.Insert(pos, imageItem); } })); }
public IEnumerable <string> Solve() { IEnumerable <Photo> horizontals = Photos.Where(p => p.IsHorizontal); foreach (var photo in horizontals) { var slide = new Slide { PhotoId = photo.Id, Tags = photo.Tags }; SlideList.Add(slide); } Random rd = new Random(); int starting = rd.Next(0, horizontals.Count()); Slideshow.Add(SlideList[starting]); SlideList.Remove(SlideList[starting]); Slide nextSlide = new Slide(); while (SlideList.Count != 0 && nextSlide != null) { nextSlide = FindNextSlide(Slideshow.Last(), SlideList); if (nextSlide != null) { Slideshow.Add(nextSlide); SlideList.Remove(nextSlide); } //Console.WriteLine(SlideList.Count); } yield return(Slideshow.Count.ToString()); foreach (var slide in Slideshow) { yield return(slide.ToString()); } }
/// <summary> /// This method can only be called after dialog is fully initialized /// </summary> /// <param name="title"></param> public SlideSelectionDialog Init(string title) { DialogTitleProperty.Text = title; Dispatcher.Invoke(new Action(() => { SlideList.Clear(); })); var currentSlide = this.GetCurrentSlide(); if (currentSlide.Index - 2 >= 0) { _prevSlideIndex = currentSlide.Index - 2; var prevSlide = this.GetCurrentPresentation().Slides[currentSlide.Index - 2]; AddSlideThumbnail(prevSlide); } else { _prevSlideIndex = currentSlide.Index - 1; } AddSlideThumbnail(currentSlide, isCurrentSlide: true); if (currentSlide.Index < this.GetCurrentPresentation().SlideCount) { _nextSlideIndex = currentSlide.Index; var nextSlide = this.GetCurrentPresentation().Slides[currentSlide.Index]; AddSlideThumbnail(nextSlide); } else { _nextSlideIndex = currentSlide.Index - 1; } SelectCurrentSlide(); LoadNextSlides(false); SlideListBox.ScrollIntoView(SlideListBox.SelectedItem); return(this); }
public HistoryArea(GameObject go_) { m_historyList = new SlideList(go_); }