Ejemplo n.º 1
0
        public void OnCustomSlideOutput(object sender, SlideMasterEventArgs e)
        {
            if (!CheckPowerPointRunning())
            {
                return;
            }
            if (e.SlideMaster == null)
            {
                return;
            }

            OutputPowerPointCustom(new[] {
                new OutputItem
                {
                    Name                   = e.SlideMaster.Name,
                    IsCurrent              = true,
                    SlidesCount            = 1,
                    PresentationSourcePath = Path.Combine(Asa.Common.Core.Configuration.ResourceManager.Instance.TempFolder.LocalPath,
                                                          Path.GetFileName(Path.GetTempFileName())),
                    SlideGeneratingAction = (processor, destinationPresentation) =>
                    {
                        var templatePath = e.SlideMaster.GetMasterPath();
                        processor.AppendSlideMaster(templatePath, destinationPresentation);
                    },
                    PreviewGeneratingAction = (processor, presentationSourcePath) =>
                    {
                        var templatePath = e.SlideMaster.GetMasterPath();
                        processor.PreparePresentation(presentationSourcePath,
                                                      presentation => processor.AppendSlideMaster(templatePath, presentation));
                    }
                }
            });
        }
Ejemplo n.º 2
0
        public void OnCustomSlidePreview(object sender, SlideMasterEventArgs e)
        {
            if (!CheckPowerPointRunning())
            {
                return;
            }
            if (e.SlideMaster == null)
            {
                return;
            }
            var previewGroup = new OutputGroup
            {
                Name      = e.SlideMaster.Name,
                IsCurrent = true,
                Items     = new List <OutputItem>(new[]
                {
                    new OutputItem
                    {
                        Name                   = e.SlideMaster.Name,
                        IsCurrent              = true,
                        SlidesCount            = 1,
                        PresentationSourcePath = Path.Combine(Asa.Common.Core.Configuration.ResourceManager.Instance.TempFolder.LocalPath,
                                                              Path.GetFileName(Path.GetTempFileName())),
                        SlideGeneratingAction = (processor, destinationPresentation) =>
                        {
                            var templatePath = e.SlideMaster.GetMasterPath();
                            processor.AppendSlideMaster(templatePath, destinationPresentation);
                        },
                        PreviewGeneratingAction = (processor, presentationSourcePath) =>
                        {
                            var templatePath = e.SlideMaster.GetMasterPath();
                            processor.PreparePresentation(presentationSourcePath,
                                                          presentation => processor.AppendSlideMaster(templatePath, presentation));
                        }
                    }
                })
            };

            var selectedOutputItems = new List <OutputItem>();

            using (var form = new FormPreview(
                       MainForm,
                       PowerPointProcessor))
            {
                form.LoadGroups(new[] { previewGroup });
                if (form.ShowDialog() == DialogResult.OK)
                {
                    selectedOutputItems.AddRange(form.GetSelectedItems());
                }
            }

            OutputPowerPointCustom(selectedOutputItems);
        }
		private void OnSlidePreview(object sender, SlideMasterEventArgs e)
		{
			SlidePreview?.Invoke(sender, e);
		}
		private void OnSlideOutput(object sender, SlideMasterEventArgs e)
		{
			SlideOutput?.Invoke(sender, e);
		}