예제 #1
0
 public void TestTempPathInit()
 {
     try
     {
         TempPath.GetPath("some-name");
         Assert.Fail();
     }
     catch (Exception)
     {
     }
 }
예제 #2
0
 public void TestTempPathInit2()
 {
     try
     {
         TempPath.InitTempFolder();
         TempPath.GetPath("some-name");
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
예제 #3
0
 public void TestApplyStyle()
 {
     TempPath.InitTempFolder();
     foreach (StyleOption style in _factory.GetAllStylesPreviewOptions())
     {
         _designer.ApplyStyle(_sourceImage, _contentSlide,
                              Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight, style);
         string imgPath = TempPath.GetPath("applystyle-" +
                                           Guid.NewGuid().ToString().Substring(0, 7) +
                                           "-" + DateTime.Now.GetHashCode());
         _contentSlide.Export(imgPath, "JPG");
         SlideUtil.IsSameLooking(
             new FileInfo(PathUtil.GetDocTestPath() +
                          "PictureSlidesLab\\" +
                          style.StyleName + ".jpg"),
             new FileInfo(imgPath));
     }
 }
예제 #4
0
        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);
                }
            }));
        }
예제 #5
0
 public PreviewInfo()
 {
     PreviewApplyStyleImagePath = TempPath.GetPath("previewapply");
 }