コード例 #1
0
        private void UpdateStylesVariationImages(ImageItem source, Slide contentSlide,
                                                 float slideWidth, float slideHeight, bool isMockPreviewImages = false)
        {
            Logger.Log("UpdateStylesVariationImages begins");
            var copiedPicture = LoadClipboardPicture();

            try
            {
                if (isMockPreviewImages)
                {
                    Logger.Log("Generate mock images for Picture aspect");
                }
                Logger.Log("Number of styles: " + _styleOptions.Count);
                for (var i = 0; i < _styleOptions.Count; i++)
                {
                    var         styleOption = _styleOptions[i];
                    PreviewInfo previewInfo;
                    if (isMockPreviewImages)
                    {
                        previewInfo = new PreviewInfo
                        {
                            PreviewApplyStyleImagePath = StoragePath.NoPicturePlaceholderImgPath
                        };
                    }
                    else
                    {
                        previewInfo = Designer.PreviewApplyStyle(
                            IsInPictureVariation()
                                ? _8PicturesInPictureVariation[i]
                                : source,
                            contentSlide, slideWidth, slideHeight, styleOption);
                    }
                    StylesVariationList.Add(new ImageItem
                    {
                        ImageFile = previewInfo.PreviewApplyStyleImagePath,
                        Tooltip   = styleOption.OptionName
                    });
                }
                GC.Collect();
            }
            catch (Exception e)
            {
                View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorImageCorrupted, e);
                Logger.LogException(e, "UpdateStylesVariationImages");
            }
            SaveClipboardPicture(copiedPicture);
            Logger.Log("UpdateStylesVariationImages done");
        }
コード例 #2
0
 private void UpdateStylesVariationImages(ImageItem source, Slide contentSlide,
                                          float slideWidth, float slideHeight)
 {
     try
     {
         foreach (var styleOption in _styleOptions)
         {
             var previewInfo = Designer.PreviewApplyStyle(source, contentSlide,
                                                          slideWidth, slideHeight, styleOption);
             StylesVariationList.Add(new ImageItem
             {
                 ImageFile = previewInfo.PreviewApplyStyleImagePath,
                 Tooltip   = styleOption.OptionName
             });
         }
     }
     catch
     {
         View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorImageCorrupted);
     }
 }
コード例 #3
0
        private void UpdateStylesVariationImages(ImageItem source, Slide contentSlide,
                                                 float slideWidth, float slideHeight, bool isMockPreviewImages = false, int selectedId = -1)
        {
            Logger.Log("UpdateStylesVariationImages begins");
            var copiedPicture = LoadClipboardPicture();

            try
            {
                if (isMockPreviewImages)
                {
                    Logger.Log("Generate mock images for Picture aspect");
                }
                Logger.Log("Number of styles: " + _styleOptions.Count);
                if (selectedId != -1)
                {
                    StylesVariationList[selectedId] =
                        GenerateImageItem(source, contentSlide, slideWidth, slideHeight, isMockPreviewImages, selectedId);
                }
                else
                {
                    for (var i = 0; i < _styleOptions.Count; i++)
                    {
                        StylesVariationList.Add(
                            GenerateImageItem(source, contentSlide, slideWidth, slideHeight, isMockPreviewImages, i));
                    }
                }
                GC.Collect();
            }
            catch (Exception e)
            {
                View.ShowErrorMessageBox(PictureSlidesLabText.ErrorImageCorrupted, e);
                Logger.LogException(e, "UpdateStylesVariationImages");
            }
            SaveClipboardPicture(copiedPicture);
            Logger.Log("UpdateStylesVariationImages done");
        }