private IList <OutputItem> GetOutputItems()
        {
            var selectedOutputItems = new List <OutputItem>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
            FormProgress.ShowProgress();
            var availableOutputGroups = xtraTabControlEditors.TabPages
                                        .OfType <IDigitalOutputContainer>()
                                        .Select(oc => oc.GetOutputGroup())
                                        .ToList();

            FormProgress.CloseProgress();

            if (!availableOutputGroups.Any())
            {
                return(selectedOutputItems);
            }

            using (var form = new FormPreview(
                       Controller.Instance.FormMain,
                       BusinessObjects.Instance.PowerPointManager.Processor))
            {
                form.LoadGroups(availableOutputGroups);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    selectedOutputItems.AddRange(form.GetSelectedItems());
                }
            }

            return(selectedOutputItems);
        }
Exemple #2
0
        public void Preview()
        {
            FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
            FormProgress.ShowProgress();
            string tempFileName = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName()));

            AdSchedulePowerPointHelper.Instance.PrepareMultiSummaryEmail(tempFileName);
            Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
            FormProgress.CloseProgress();
            if (!File.Exists(tempFileName))
            {
                return;
            }
            using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
            {
                formPreview.Text = "Preview Multi-Publication Analysis";
                formPreview.LoadGroups(new[] { new PreviewGroup {
                                                   Name = "Preview", PresentationSourcePath = tempFileName
                                               } });
                RegistryHelper.MainFormHandle   = formPreview.Handle;
                RegistryHelper.MaximizeMainForm = false;
                DialogResult previewResult = formPreview.ShowDialog();
                RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
                RegistryHelper.MainFormHandle   = Controller.Instance.FormMain.Handle;
                if (previewResult != DialogResult.OK)
                {
                    Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
                }
            }
        }
Exemple #3
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);
        }
        public IList <OutputItem> GetOutputItems(bool onlyCurrentSlide)
        {
            var selectedOutputItems = new List <OutputItem>();

            var availableOutputGroups = new List <OutputGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Slides...");
            FormProgress.ShowProgress(MainForm);
            if (onlyCurrentSlide)
            {
                if (ActiveSlide is IDashboardSlide dashboardSlide)
                {
                    availableOutputGroups.Add(dashboardSlide.GetOutputData());
                }
            }
            else
            {
                var allSlides = _slides
                                .OfType <IDashboardSlide>()
                                .ToList();

                foreach (var dashboardSlide in allSlides)
                {
                    availableOutputGroups.Add(dashboardSlide.GetOutputData());
                    Application.DoEvents();
                }
            }
            FormProgress.CloseProgress();

            if (!availableOutputGroups.Any())
            {
                return(selectedOutputItems);
            }

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

            return(selectedOutputItems);
        }
 public override void ShowPreview(IEnumerable <PreviewGroup> previewGroups, Action trackOutput)
 {
     using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, trackOutput))
     {
         formPreview.Text = "Preview Digital Product";
         formPreview.LoadGroups(previewGroups);
         RegistryHelper.MainFormHandle   = formPreview.Handle;
         RegistryHelper.MaximizeMainForm = false;
         var previewResult = formPreview.ShowDialog();
         RegistryHelper.MaximizeMainForm = _formContainer.WindowState == FormWindowState.Maximized;
         RegistryHelper.MainFormHandle   = _formContainer.Handle;
         if (previewResult != DialogResult.OK)
         {
             Utilities.Instance.ActivateForm(_formContainer.Handle, true, false);
         }
     }
 }
        private List <OutputItem> GetOutputItems(bool onlyCurrentSlide)
        {
            var selectedOutputItems = new List <OutputItem>();

            var availableOutputGroups = new List <OutputGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Slides...");
            FormProgress.ShowProgress(Controller.Instance.FormMain);
            if (onlyCurrentSlide)
            {
                if (ActiveOptionSetContainer != null)
                {
                    availableOutputGroups.Add(ActiveOptionSetContainer.GetOutputGroup());
                }
            }
            else
            {
                var outputContainers = xtraTabControlContentEditors.TabPages
                                       .OfType <IOutputContainer>()
                                       .ToList();
                foreach (var outputContainer in outputContainers)
                {
                    availableOutputGroups.Add(outputContainer.GetOutputGroup());
                    Application.DoEvents();
                }
            }
            FormProgress.CloseProgress();

            if (!availableOutputGroups.Any())
            {
                return(selectedOutputItems);
            }

            using (var form = new FormPreview(
                       Controller.Instance.FormMain,
                       BusinessObjects.Instance.PowerPointManager.Processor))
            {
                form.LoadGroups(availableOutputGroups);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    selectedOutputItems.AddRange(form.GetSelectedItems());
                }
            }

            return(selectedOutputItems);
        }
Exemple #7
0
        private IList <OutputItem> GetOutputItems(SlideMaster slideMaster = null)
        {
            var selectedSlideMaster = slideMaster ?? _slideContainer.SelectedSlide;
            var defaultOutputGroup  = new OutputGroup
            {
                Name      = "Preview",
                IsCurrent = true,
                Items     = new List <OutputItem>(new[]
                {
                    new OutputItem
                    {
                        Name                   = "Preview",
                        IsCurrent              = true,
                        SlidesCount            = 1,
                        PresentationSourcePath = Path.Combine(Common.Core.Configuration.ResourceManager.Instance.TempFolder.LocalPath,
                                                              Path.GetFileName(Path.GetTempFileName())),
                        SlideGeneratingAction = (processor, destinationPresentation) =>
                        {
                            var templatePath = selectedSlideMaster.GetMasterPath();
                            processor.AppendSlideMaster(templatePath, destinationPresentation);
                        },
                        PreviewGeneratingAction = (processor, presentationSourcePath) =>
                        {
                            var templatePath = selectedSlideMaster.GetMasterPath();
                            processor.PreparePresentation(presentationSourcePath,
                                                          presentation => processor.AppendSlideMaster(templatePath, presentation));
                        }
                    }
                })
            };

            var selectedOutputItems = new List <OutputItem>();

            using (var form = new FormPreview(
                       Controller.Instance.FormMain,
                       BusinessObjects.Instance.PowerPointManager.Processor))
            {
                form.LoadGroups(new[] { defaultOutputGroup });
                if (form.ShowDialog() == DialogResult.OK)
                {
                    selectedOutputItems.AddRange(form.GetSelectedItems());
                }
            }

            return(selectedOutputItems);
        }
Exemple #8
0
        protected override void PreviewInternal(IEnumerable <CalendarOutputData> outputData)
        {
            if (outputData == null)
            {
                return;
            }
            var commonOutputData = outputData.OfType <AdCalendarOutputData>();
            var previewGroups    = new List <PreviewGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Calendar for Preview...");
            FormProgress.ShowProgress();
            Enabled = false;
            foreach (var outputItem in commonOutputData)
            {
                var previewGroup = new PreviewGroup
                {
                    Name = outputItem.MonthText,
                    PresentationSourcePath = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName()))
                };
                AdSchedulePowerPointHelper.Instance.PrepareCalendarEmail(previewGroup.PresentationSourcePath, new[] { outputItem });
                previewGroups.Add(previewGroup);
            }
            Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
            Enabled = true;
            FormProgress.CloseProgress();
            if (!(previewGroups.Any() && previewGroups.All(pg => File.Exists(pg.PresentationSourcePath))))
            {
                return;
            }
            using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
            {
                formPreview.Text = "Preview this Calendar";
                formPreview.LoadGroups(previewGroups);
                RegistryHelper.MainFormHandle   = formPreview.Handle;
                RegistryHelper.MaximizeMainForm = false;
                var previewResult = formPreview.ShowDialog();
                RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
                RegistryHelper.MainFormHandle   = Controller.Instance.FormMain.Handle;
                if (previewResult != DialogResult.OK)
                {
                    Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
                }
            }
        }
 protected override void ShowPreview(string tempFileName)
 {
     using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
     {
         formPreview.Text = "Preview AdPlan";
         formPreview.LoadGroups(new[] { new PreviewGroup {
                                            Name = "Preview", PresentationSourcePath = tempFileName
                                        } });
         RegistryHelper.MainFormHandle   = formPreview.Handle;
         RegistryHelper.MaximizeMainForm = false;
         var previewResult = formPreview.ShowDialog();
         RegistryHelper.MaximizeMainForm = _formContainer.WindowState == FormWindowState.Maximized;
         RegistryHelper.MainFormHandle   = _formContainer.Handle;
         if (previewResult != DialogResult.OK)
         {
             Utilities.Instance.ActivateForm(_formContainer.Handle, true, false);
         }
     }
 }
Exemple #10
0
        public override void Email()
        {
            var currentMonth = CalendarView.SelectedMonthData;

            foreach (var month in ActiveCalendarSection.Months)
            {
                month.OutputData.PrepareNotes();
            }

            var monthOutputItems = ActiveCalendarSection.Months
                                   .Select(month => new CaledarMonthOutputItem(month)
            {
                IsCurrent = currentMonth == month
            })
                                   .ToList();
            var selectedOutputItems = new List <OutputItem>();
            var previewGroups       = GeneratePreviewData(monthOutputItems);

            if (previewGroups.Count > 1)
            {
                using (var form = new FormPreview(
                           FormMain,
                           PowerPointProcessor))
                {
                    form.LoadGroups(previewGroups);
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        selectedOutputItems.AddRange(form.GetSelectedItems());
                    }
                }
            }
            else
            {
                selectedOutputItems.AddRange(previewGroups.SelectMany(group => group.Items));
            }
            if (!selectedOutputItems.Any())
            {
                return;
            }
            EmailSlides(selectedOutputItems);
        }
Exemple #11
0
 private void toolStripButtonViewContent_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         string      repository = this.Wizard.Data[Search.REPOSITORY_ID].ToString();
         VersionInfo version    = (VersionInfo)this.listView1.SelectedItems[0].Tag;
         String      name       = null;
         try
         {
             name = OfficeApplication.OfficeDocumentProxy.createPreview(repository, version.contentId, version.nameOfVersion, type);
             String urlproxy = OfficeApplication.OfficeDocumentProxy.WebAddress.ToString();
             if (!urlproxy.EndsWith("/gtw"))
             {
                 if (!urlproxy.EndsWith("/"))
                 {
                     urlproxy += "/";
                 }
                 if (!urlproxy.EndsWith("gtw"))
                 {
                     urlproxy += "gtw";
                 }
             }
             Uri         url         = new Uri(urlproxy + "?contentId=" + version.contentId + "&versionName=" + version.nameOfVersion + "&repositoryName=" + repository + "&name=" + name + "&type=" + type);
             String      title       = OfficeApplication.OfficeDocumentProxy.getTitle(repository, version.contentId);
             FormPreview formPreview = new FormPreview(url, false, title);
             formPreview.ShowDialog(this);
         }
         finally
         {
             if (name != null)
             {
                 OfficeApplication.OfficeDocumentProxy.deletePreview(name);
             }
         }
     }
 }
		public void Preview()
		{
			FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
			FormProgress.ShowProgress();
			string tempFileName = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName()));
			AdSchedulePowerPointHelper.Instance.PrepareMultiSummaryEmail(tempFileName);
			Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			FormProgress.CloseProgress();
			if (!File.Exists(tempFileName)) return;
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
			{
				formPreview.Text = "Preview Multi-Publication Analysis";
				formPreview.LoadGroups(new[] { new PreviewGroup { Name = "Preview", PresentationSourcePath = tempFileName } });
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				DialogResult previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			}
		}
Exemple #13
0
        public void Preview()
        {
            Save();
            var tabPages         = xtraTabControlPublications.TabPages.Where(tabPage => tabPage.PageEnabled).OfType <IBasicOverviewOutputControl>();
            var selectedProducts = new List <IBasicOverviewOutputControl>();

            if (tabPages.Count() > 1)
            {
                using (var form = new FormSelectOutputItems())
                {
                    form.Text = "Select Products";
                    var currentProduct = xtraTabControlPublications.SelectedTabPage as IBasicOverviewOutputControl;
                    foreach (var tabPage in tabPages)
                    {
                        var item = new CheckedListBoxItem(tabPage, tabPage.SlideName);
                        form.checkedListBoxControlOutputItems.Items.Add(item);
                        if (tabPage == currentProduct)
                        {
                            form.buttonXSelectCurrent.Tag = item;
                        }
                    }
                    form.checkedListBoxControlOutputItems.CheckAll();
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        selectedProducts.AddRange(form.checkedListBoxControlOutputItems.Items.
                                                  OfType <CheckedListBoxItem>().
                                                  Where(ci => ci.CheckState == CheckState.Checked).
                                                  Select(ci => ci.Value).
                                                  OfType <IBasicOverviewOutputControl>());
                    }
                }
            }
            else
            {
                selectedProducts.AddRange(tabPages);
            }
            if (!selectedProducts.Any())
            {
                return;
            }
            var previewGroups = new List <PreviewGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
            FormProgress.ShowProgress();
            foreach (var productControl in selectedProducts)
            {
                var previewGroup = productControl.GetPreviewGroup();
                if (productControl is PublicationBasicOverviewControl)
                {
                    AdSchedulePowerPointHelper.Instance.PrepareBasicOverviewEmail(previewGroup.PresentationSourcePath, new[] { (PublicationBasicOverviewControl)productControl });
                }
                else if (productControl is BasicOverviewSummaryControl)
                {
                    var summaryControl = productControl as BasicOverviewSummaryControl;
                    summaryControl.PopulateReplacementsList();
                    AdSchedulePowerPointHelper.Instance.PrepareBasicOverviewSummaryEmail(previewGroup.PresentationSourcePath, summaryControl);
                }
                previewGroups.Add(previewGroup);
            }
            Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
            FormProgress.CloseProgress();
            if (!(previewGroups.Any() && previewGroups.All(pg => File.Exists(pg.PresentationSourcePath))))
            {
                return;
            }
            var trackAction = new Action(() => TrackOutput(selectedProducts.OfType <PublicationBasicOverviewControl>()));

            using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, trackAction))
            {
                formPreview.Text = "Preview Basic Overview";
                formPreview.LoadGroups(previewGroups);
                RegistryHelper.MainFormHandle   = formPreview.Handle;
                RegistryHelper.MaximizeMainForm = false;
                var previewResult = formPreview.ShowDialog();
                RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
                RegistryHelper.MainFormHandle   = Controller.Instance.FormMain.Handle;
                if (previewResult != DialogResult.OK)
                {
                    Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
                }
            }
        }
		public void Preview()
		{
			var tabPages = _tabPages;
			var selectedProducts = new List<PublicationDetailedGridControl>();
			if (tabPages.Count() > 1)
				using (var form = new FormSelectOutputItems())
				{
					form.Text = "Select Products";
					var currentProduct = xtraTabControlPublications.SelectedTabPage as PublicationDetailedGridControl;
					foreach (var tabPage in tabPages)
					{
						var item = new CheckedListBoxItem(tabPage, tabPage.PrintProduct.Name);
						form.checkedListBoxControlOutputItems.Items.Add(item);
						if (tabPage == currentProduct)
							form.buttonXSelectCurrent.Tag = item;
					}
					form.checkedListBoxControlOutputItems.CheckAll();
					if (form.ShowDialog() == DialogResult.OK)
						selectedProducts.AddRange(form.checkedListBoxControlOutputItems.Items.
							OfType<CheckedListBoxItem>().
							Where(ci => ci.CheckState == CheckState.Checked).
							Select(ci => ci.Value).
							OfType<PublicationDetailedGridControl>());
				}
			else
				selectedProducts.AddRange(tabPages);
			if (!selectedProducts.Any()) return;
			var tempFileName = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName()));
			FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
			FormProgress.ShowProgress();
			foreach (var product in selectedProducts)
				product.PrepareOutput();
			AdSchedulePowerPointHelper.Instance.PrepareDetailedGridGridBasedEmail(tempFileName, selectedProducts.ToArray());
			Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			FormProgress.CloseProgress();
			if (!File.Exists(tempFileName)) return;
			var trackAction = new Action(() => TrackOutput(selectedProducts));
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, trackAction))
			{
				formPreview.Text = "Preview Detailed Advertising Grid";
				formPreview.LoadGroups(new[] { new PreviewGroup { Name = "Preview", PresentationSourcePath = tempFileName } });
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				var previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			}
		}
		protected override void ShowPreview(string tempFileName)
		{
			Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
			{
				formPreview.Text = "Preview Summary";
				formPreview.LoadGroups(new[] { new PreviewGroup { Name = "Preview", PresentationSourcePath = tempFileName } });
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				DialogResult previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			}
		}
        protected IList <OutputItem> GetOutputItems(bool onlyCurrentSlide)
        {
            var selectedOutputItems = new List <OutputItem>();

            var availableOutputGroups = new List <OutputGroup>();

            FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Slides...");
            FormProgress.ShowProgress(MainForm);
            if (onlyCurrentSlide)
            {
                if (ActiveSlideContent != null)
                {
                    availableOutputGroups.Add(ActiveSlideContent.GetOutputGroup());
                }
            }
            else
            {
                var allSlides = _slides
                                .OfType <IShiftTabPageContainer>()
                                .ToList();

                foreach (var tabPageContainer in allSlides.Where(slide => slide.ContentControl == null).ToList())
                {
                    tabPageContainer.LoadContent();
                    if (tabPageContainer.ContentControl is MultiTabControl multiTabControl)
                    {
                        multiTabControl.LoadAllTabPages();
                        Application.DoEvents();
                    }
                }

                var contentControls = allSlides
                                      .Select(container => container.ContentControl)
                                      .ToList();
                foreach (var contentControl in contentControls)
                {
                    var outputGroup = contentControl.GetOutputGroup();
                    if (outputGroup.Items.Any())
                    {
                        availableOutputGroups.Add(outputGroup);
                    }
                    Application.DoEvents();
                }
            }
            FormProgress.CloseProgress();

            if (!availableOutputGroups.SelectMany(group => group.Items).Any())
            {
                return(selectedOutputItems);
            }

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

            return(selectedOutputItems);
        }
		protected override void PreviewInternal(IEnumerable<CalendarOutputData> outputData)
		{
			if (outputData == null) return;
			var commonOutputData = outputData.OfType<AdCalendarOutputData>();
			var previewGroups = new List<PreviewGroup>();
			FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Calendar for Preview...");
			FormProgress.ShowProgress();
			Enabled = false;
			foreach (var outputItem in commonOutputData)
			{
				var previewGroup = new PreviewGroup
				{
					Name = outputItem.MonthText,
					PresentationSourcePath = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName()))
				};
				AdSchedulePowerPointHelper.Instance.PrepareCalendarEmail(previewGroup.PresentationSourcePath, new[] { outputItem });
				previewGroups.Add(previewGroup);
			}
			Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			Enabled = true;
			FormProgress.CloseProgress();
			if (!(previewGroups.Any() && previewGroups.All(pg => File.Exists(pg.PresentationSourcePath)))) return;
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, TrackOutput))
			{
				formPreview.Text = "Preview this Calendar";
				formPreview.LoadGroups(previewGroups);
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				var previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			}
		}
		public void Preview()
		{
			Save();
			var tabPages = xtraTabControlPublications.TabPages.Where(tabPage => tabPage.PageEnabled).OfType<IBasicOverviewOutputControl>();
			var selectedProducts = new List<IBasicOverviewOutputControl>();
			if (tabPages.Count() > 1)
				using (var form = new FormSelectOutputItems())
				{
					form.Text = "Select Products";
					var currentProduct = xtraTabControlPublications.SelectedTabPage as IBasicOverviewOutputControl;
					foreach (var tabPage in tabPages)
					{
						var item = new CheckedListBoxItem(tabPage, tabPage.SlideName);
						form.checkedListBoxControlOutputItems.Items.Add(item);
						if (tabPage == currentProduct)
							form.buttonXSelectCurrent.Tag = item;
					}
					form.checkedListBoxControlOutputItems.CheckAll();
					if (form.ShowDialog() == DialogResult.OK)
						selectedProducts.AddRange(form.checkedListBoxControlOutputItems.Items.
							OfType<CheckedListBoxItem>().
							Where(ci => ci.CheckState == CheckState.Checked).
							Select(ci => ci.Value).
							OfType<IBasicOverviewOutputControl>());
				}
			else
				selectedProducts.AddRange(tabPages);
			if (!selectedProducts.Any()) return;
			var previewGroups = new List<PreviewGroup>();
			FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Preview...");
			FormProgress.ShowProgress();
			foreach (var productControl in selectedProducts)
			{
				var previewGroup = productControl.GetPreviewGroup();
				if (productControl is PublicationBasicOverviewControl)
					AdSchedulePowerPointHelper.Instance.PrepareBasicOverviewEmail(previewGroup.PresentationSourcePath, new[] { (PublicationBasicOverviewControl)productControl });
				else if (productControl is BasicOverviewSummaryControl)
				{
					var summaryControl = productControl as BasicOverviewSummaryControl;
					summaryControl.PopulateReplacementsList();
					AdSchedulePowerPointHelper.Instance.PrepareBasicOverviewSummaryEmail(previewGroup.PresentationSourcePath, summaryControl);
				}
				previewGroups.Add(previewGroup);
			}
			Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			FormProgress.CloseProgress();
			if (!(previewGroups.Any() && previewGroups.All(pg => File.Exists(pg.PresentationSourcePath)))) return;
			var trackAction = new Action(() => TrackOutput(selectedProducts.OfType<PublicationBasicOverviewControl>()));
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, trackAction))
			{
				formPreview.Text = "Preview Basic Overview";
				formPreview.LoadGroups(previewGroups);
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				var previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = Controller.Instance.FormMain.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false);
			}
		}
		public override void ShowPreview(IEnumerable<PreviewGroup> previewGroups, Action trackOutput)
		{
			using (var formPreview = new FormPreview(Controller.Instance.FormMain, AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager, Controller.Instance.ShowFloater, trackOutput))
			{
				formPreview.Text = "Preview Digital Product";
				formPreview.LoadGroups(previewGroups);
				RegistryHelper.MainFormHandle = formPreview.Handle;
				RegistryHelper.MaximizeMainForm = false;
				var previewResult = formPreview.ShowDialog();
				RegistryHelper.MaximizeMainForm = _formContainer.WindowState == FormWindowState.Maximized;
				RegistryHelper.MainFormHandle = _formContainer.Handle;
				if (previewResult != DialogResult.OK)
					Utilities.Instance.ActivateForm(_formContainer.Handle, true, false);
			}
		}