private bool HandleVideoDownloaded(string filePath) { _siteContainer.ParentBundle.PowerPointSingleton.Connect(); var activePresentation = _siteContainer.ParentBundle.PowerPointSingleton.GetActivePresentation(); var allowVideoInsert = activePresentation != null && File.Exists(activePresentation.FullName); if (allowVideoInsert) { using (var formComplete = new FormVideoDownloadComplete(filePath)) { var result = formComplete.ShowDialog(_siteContainer.ParentBundle.MainForm); if (result == DialogResult.Abort) { _siteContainer.ParentBundle.ShowFloater(new FloaterRequestedEventArgs { AfterShow = () => { FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowOutputProgress(); _siteContainer.ParentBundle.PowerPointSingleton.InsertVideoIntoActivePresentation(filePath); FormProgress.CloseProgress(); } }); } return(true); } } return(false); }
private void GenerateOutput(SlideMaster slideMaster) { if (!AppManager.Instance.CheckPowerPointRunning()) { return; } var outputItems = GetOutputItems(slideMaster); if (!outputItems.Any()) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowOutputProgress(); AppManager.Instance.ShowFloater(() => { foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(AppManager.Instance.PowerPointManager.Processor, null); } FormProgress.CloseProgress(); }); }
private void OnProcessFileDialog(Object sender, FileDialogEventArgs e) { switch (e.Mode) { case FileDialogMode.Save: using (var saveDialog = new SaveFileDialog()) { saveDialog.Title = e.Title; saveDialog.Filter = e.Filter; saveDialog.FileName = e.DefaultFileName; if (saveDialog.ShowDialog() != DialogResult.Cancel) { FormProgress.ShowProgress(); FormProgress.SetTitle("Downloading…", true); FormProgress.SetDetails(Path.GetFileName(saveDialog.FileName)); Application.DoEvents(); e.Continue(saveDialog.FileName); } else { e.Cancel(); } } break; } e.Handled = true; }
public void LoadViewer() { if (Loaded) { return; } var thread = new Thread(() => Invoke((MethodInvoker) delegate() { var word = new WordHelper(); if (word.Connect()) { var g = Guid.NewGuid(); string newFileName = Path.Combine(ResourceManager.Instance.TempFolder.LocalPath, g + ".html"); word.ConvertToHtml(File.FullName, newFileName); word.Disconnect(); webBrowser.Url = new Uri(newFileName); } Loaded = true; })); FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Page..."); FormProgress.ShowProgress(); Application.DoEvents(); thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } FormProgress.CloseProgress(); }
public void Email() { FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Presentation for Email..."); FormProgress.ShowProgress(); var tempFileName = Path.Combine(Core.Common.ResourceManager.Instance.TempFolder.LocalPath, Path.GetFileName(Path.GetTempFileName())); AdSchedulePowerPointHelper.Instance.PrepareSnapshotEmail(tempFileName); FormProgress.CloseProgress(); if (!File.Exists(tempFileName)) { return; } using (var formEmail = new FormEmail(AdSchedulePowerPointHelper.Instance, BusinessObjects.Instance.HelpManager)) { formEmail.Text = "Email this Ad Schedule Snapshot"; formEmail.LoadGroups(new[] { new PreviewGroup { Name = "Preview", PresentationSourcePath = tempFileName } }); Utilities.Instance.ActivateForm(Controller.Instance.FormMain.Handle, true, false); RegistryHelper.MainFormHandle = formEmail.Handle; RegistryHelper.MaximizeMainForm = false; formEmail.ShowDialog(); RegistryHelper.MaximizeMainForm = true; RegistryHelper.MainFormHandle = Controller.Instance.FormMain.Handle; } }
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); } } }
protected override void OutputPdfSlides(IList <OutputItem> outputItems) { FormProgress.SetTitle(outputItems.Count == 2 ? "Creating 2 (two) Calendar slides…\nThis will take about a minute…" : "Creating Calendar slides…\nThis will take a few minutes…"); FormProgress.ShowOutputProgress(); Controller.Instance.ShowFloater(() => { Enabled = false; var pdfFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1:MM-dd-yy-hmmss}.pdf", Schedule.Name, DateTime.Now)); PowerPointProcessor.BuildPdf(pdfFileName, presentation => { foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(PowerPointProcessor, presentation); } }); if (File.Exists(pdfFileName)) { try { Process.Start(pdfFileName); } catch { } } Enabled = true; FormProgress.CloseProgress(); }); }
public override void OutputPdf() { var outputItems = GetOutputItems(false); if (!outputItems.Any()) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowOutputProgress(); Controller.Instance.ShowFloater(() => { var pdfFileName = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1:MM-dd-yy-hmmss}.pdf", "star", DateTime.Now)); BusinessObjects.Instance.PowerPointManager.Processor.BuildPdf(pdfFileName, presentation => { foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(BusinessObjects.Instance.PowerPointManager.Processor, presentation); } }); FormProgress.CloseProgress(); if (File.Exists(pdfFileName)) { try { Process.Start(pdfFileName); } catch { } } }); }
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); }
protected override void OutputPdf() { SaveSchedule(); if (!CheckPowerPointRunning()) { return; } TrackOutput(); FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); var pdfFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1}.pdf", LocalSchedule.Name, DateTime.Now.ToString("MM-dd-yy-hmmss"))); AdSchedulePowerPointHelper.Instance.PrepareSummaryPdf(pdfFileName, this); if (File.Exists(pdfFileName)) { try { Process.Start(pdfFileName); } catch { } } FormProgress.CloseProgress(); }); }
protected override void OpenLinkInternal() { var buffer = new byte[1024 * 1024]; // 1MB buffer var sourceFile = new FileInfo(_path); var fileName = Path.GetFileName(_path); var destinationPath = Path.Combine(ResourceManager.Instance.TempFolder.LocalPath, fileName); var destinationFile = new FileInfo(destinationPath); if (!sourceFile.Exists) { PopupMessageHelper.Instance.ShowWarning(String.Format("You do not have a network connection to this file.{0}Connect to your network, and then try again.", Environment.NewLine)); return; } if (!(destinationFile.Exists && destinationFile.LastWriteTime >= sourceFile.LastWriteTime && destinationFile.Length == sourceFile.Length)) { if (File.Exists(destinationPath)) { File.Delete(destinationPath); } FileStorageManager.Instance.Downloading += OnFileDownloading; FormProgress.SetTitle("Loading file...", true); FormProgress.ShowProgress(); var thread = new Thread(() => { using (var source = new FileStream(_path, FileMode.Open, FileAccess.Read)) { var fileLength = source.Length; using (var dest = new FileStream(destinationPath, FileMode.CreateNew, FileAccess.Write)) { decimal totalBytes = 0; int currentBlockSize; while ((currentBlockSize = source.Read(buffer, 0, buffer.Length)) > 0) { totalBytes += currentBlockSize; dest.Write(buffer, 0, currentBlockSize); FileStorageManager.Instance.ShowDownloadProgress(new FileProcessingProgressEventArgs(fileName, fileLength, totalBytes)); } } } }); thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } FileStorageManager.Instance.Downloading -= OnFileDownloading; FormProgress.CloseProgress(); } try { Process.Start(destinationPath); } catch { } }
public void Output() { FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowProgress(); AppManager.Instance.ShowFloater(() => { AppManager.Instance.PowerPointManager.Processor.AppendCleanslate(); FormProgress.CloseProgress(); }); }
public void InitSite() { if (_loaded) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Page..."); FormProgress.ShowProgress(); Application.DoEvents(); _browser.WebView.LoadUrl(SiteSettings.BaseUrl); }
protected override void OutputSlides() { TrackOutput(); FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); OnlineSchedulePowerPointHelper.Instance.AppendAdPlan(this); FormProgress.CloseProgress(); }); }
public void PrintOutput() { TrackOutput(); FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); AdSchedulePowerPointHelper.Instance.AppendMultiSummary(); FormProgress.CloseProgress(); }); }
public override void Email() { var outputItems = GetOutputItems(false); if (!outputItems.Any()) { return; } using (var form = new FormEmailFileName()) { if (form.ShowDialog() == DialogResult.OK) { FormProgress.SetTitle("Chill-Out for a few seconds...\nPreparing Email..."); FormProgress.ShowProgress(); Controller.Instance.ShowFloater(() => { var emailFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1:MM-dd-yy-hmmss}.pdf", Schedule.Name, DateTime.Now)); var defaultItem = outputItems.First(); BusinessObjects.Instance.PowerPointManager.Processor.PreparePresentation(emailFileName, presentation => { foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(BusinessObjects.Instance.PowerPointManager.Processor, presentation); } }); var emailFile = Path.Combine( Path.GetFullPath(defaultItem.PresentationSourcePath) .Replace(Path.GetFileName(defaultItem.PresentationSourcePath), string.Empty), form.FileName + ".pptx"); File.Copy(emailFileName, emailFile, true); FormProgress.CloseProgress(); try { if (OutlookHelper.Instance.Open()) { OutlookHelper.Instance.CreateMessage("Advertising Schedule", emailFile); OutlookHelper.Instance.Close(); } else { PopupMessageHelper.Instance.ShowWarning("Cannot open Outlook"); } File.Delete(emailFile); } catch { } }); } } }
public void PrintOutput() { 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; } TrackOutput(selectedProducts.OfType <PublicationBasicOverviewControl>()); FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); foreach (var product in selectedProducts) { product.Output(); } FormProgress.CloseProgress(); }); }
public override void OutputSlides(IEnumerable <IDigitalOutputControl> tabsForOutput) { FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); foreach (var tabPage in tabsForOutput) { tabPage.Output(); } FormProgress.CloseProgress(); }); }
public override void OutputPowerPointCustom(IList <OutputItem> outputItems) { if (!outputItems.Any()) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowOutputProgress(); Controller.Instance.ShowFloater(() => { outputItems.ForEach(item => item.SlideGeneratingAction?.Invoke(BusinessObjects.Instance.PowerPointManager.Processor, null)); FormProgress.CloseProgress(); }); }
public void LoadViewer() { if (Loaded) { return; } TabControl.Enabled = false; FormProgress.SetTitle("Chill-Out for a few seconds...\nLoading Page..."); FormProgress.ShowProgress(); Application.DoEvents(); var url = System.IO.File.ReadAllText(File.FullName).Trim(); _browser.WebView.LoadUrl(url.Replace(" ", "%20")); }
private void GenerateOutput(SlideMaster slideMaster) { if (!AppManager.Instance.CheckPowerPointRunning()) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); AppManager.Instance.ShowFloater(() => { FormProgress.ShowProgress(); var templatePath = slideMaster.GetMasterPath(); AppManager.Instance.PowerPointManager.Processor.AppendSlideMaster(templatePath); FormProgress.CloseProgress(); }); }
protected override void Output() { SaveSchedule(); if (!CheckPowerPointRunning()) { return; } TrackOutput(); FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); AdSchedulePowerPointHelper.Instance.AppendSummary(this); FormProgress.CloseProgress(); }); }
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); }
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); }
protected override void OutpuPowerPointSlides(IList <OutputItem> outputItems) { FormProgress.SetTitle(outputItems.Count == 2 ? "Creating 2 (two) Calendar slides…\nThis will take about a minute…" : "Creating Calendar slides…\nThis will take a few minutes…"); FormProgress.ShowOutputProgress(); Controller.Instance.ShowFloater(() => { Enabled = false; foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(PowerPointProcessor, null); } Enabled = true; FormProgress.CloseProgress(); }); }
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 override void PdfSlides() { FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); var pdfFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1}.pdf", LocalSchedule.Name, DateTime.Now.ToString("MM-dd-yy-hmmss"))); OnlineSchedulePowerPointHelper.Instance.PrepareWebPackagePdf(this, pdfFileName); if (File.Exists(pdfFileName)) { try { Process.Start(pdfFileName); } catch { } } FormProgress.CloseProgress(); }); }
public override void ShowPdf(IEnumerable <PreviewGroup> previewGroups, Action trackOutput) { FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress(); var pdfFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1}.pdf", LocalSchedule.Name, DateTime.Now.ToString("MM-dd-yy-hmmss"))); AdSchedulePowerPointHelper.Instance.BuildPdf(pdfFileName, previewGroups.Select(pg => pg.PresentationSourcePath)); if (File.Exists(pdfFileName)) { try { Process.Start(pdfFileName); } catch { } } FormProgress.CloseProgress(); }); }
protected override void PowerPointInternal(IEnumerable <CalendarOutputData> outputData) { if (outputData == null) { return; } var commonOutputData = outputData.OfType <AdCalendarOutputData>(); TrackOutput(); Controller.Instance.ShowFloater(() => { FormProgress.SetTitle(commonOutputData.Count() == 2 ? "Creating 2 (two) Calendar slides…\nThis will take about a minute…" : "Creating Calendar slides…\nThis will take a few minutes…"); FormProgress.ShowProgress(); Enabled = false; AdSchedulePowerPointHelper.Instance.AppendCalendar(commonOutputData.ToArray()); Enabled = true; FormProgress.CloseProgress(); }); }
public void OutputPowerPoint(SlideMaster slideMaster = null) { var outputItems = GetOutputItems(slideMaster); if (!outputItems.Any()) { return; } FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!"); FormProgress.ShowOutputProgress(); Controller.Instance.ShowFloater(() => { foreach (var outputItem in outputItems) { outputItem.SlideGeneratingAction?.Invoke(BusinessObjects.Instance.PowerPointManager.Processor, null); } FormProgress.CloseProgress(); }); }