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); }
private void OpenTemplate() { var templateInfo = SelectedTemplateInfo; if (templateInfo == null) { PopupMessageHelper.Instance.ShowWarning("Please select schedule in list"); return; } using (var form = new FormScheduleName()) { form.Text = "Import Schedule Template"; if (form.ShowDialog(this) != DialogResult.OK) { return; } ScheduleTemplate template = null; FormProgress.ShowProgress("Loading Schedule...", () => { AsyncHelper.RunSync(async() => { template = await BusinessObjects.Instance.ScheduleTemplatesManager.GetScheduleTemplate(templateInfo.Name); template.Name = form.ScheduleName; }); }, false); BusinessObjects.Instance.ScheduleManager.AddScheduleFromTemplate(template); } DialogResult = DialogResult.OK; Close(); }
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); } } }
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; } }
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(); }); }
private void LoadTabPage(IShiftTabPageContainer tabPageContainer, bool showSplash) { if (tabPageContainer == null) { return; } if (tabPageContainer.ContentControl != null) { return; } xtraTabControl.Selecting += OnTabPageSelecting; if (showSplash) { FormProgress.ShowProgress("Loading data...", () => { tabPageContainer.LoadContent(); tabPageContainer.ContentControl?.LoadData(); }); } else { tabPageContainer.LoadContent(); tabPageContainer.ContentControl?.LoadData(); } xtraTabControl.Selecting -= OnTabPageSelecting; }
private void OnFormLoad(object sender, EventArgs e) { FormProgress.ShowProgress("Loading your files...", () => { BusinessObjects.Instance.ScheduleManager.Init(); AsyncHelper.RunSync(BusinessObjects.Instance.ScheduleTemplatesManager.Init); var allSchedules = BusinessObjects.Instance.ScheduleManager.GetScheduleList <MediaScheduleModel>() .Where(scheduleModel => scheduleModel.Parent != BusinessObjects.Instance.ScheduleManager.ActiveSchedule).ToList(); _regularScheduleList.AddRange(allSchedules.Where(s => s.EditMode == ScheduleEditMode.Regular)); _quickScheduleList.AddRange(allSchedules.Where(s => s.EditMode == ScheduleEditMode.Quick)); AsyncHelper.RunSync(async() => { _scheduleTemplateList = await BusinessObjects.Instance.ScheduleTemplatesManager.GetTemplatesList(); }); }, false); LoadSchedules(); LoadTemplates(); xtraTabPageRegularSchedules.PageEnabled = _regularScheduleList.Any(); xtraTabPageQuickEditSchedules.PageEnabled = _quickScheduleList.Any(); xtraTabPageTemplates.PageEnabled = !FileStorageManager.Instance.UseLocalMode && _scheduleTemplateList.Items.Any(); if (_regularScheduleList.Any()) { xtraTabControl.SelectedTabPage = xtraTabPageRegularSchedules; } else if (_quickScheduleList.Any()) { xtraTabControl.SelectedTabPage = xtraTabPageQuickEditSchedules; } else if (!FileStorageManager.Instance.UseLocalMode && _scheduleTemplateList.Items.Any()) { xtraTabControl.SelectedTabPage = xtraTabPageTemplates; } }
public void OnSaveTemplate(object sender, ScheduleSavingEventArgs e) { FormProgress.ShowProgress("Saving Your Schedule Template…...", () => { AsyncHelper.RunSync(() => BusinessObjects.Instance.ScheduleTemplatesManager.SaveTemplate(BusinessObjects.Instance.ScheduleManager.ActiveSchedule.GetTemplate(e.Name))); }, false); }
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; }
private VideoClipartObject GenererateVideoClipart(string filePath) { VideoResourceItem videoResourceItem = null; FormProgress.ShowProgress("Saving Video Content...", () => { AsyncHelper.RunSync(async() => { await Task.Run(() => { videoResourceItem = VideoResourceHelper.AddVideoResource(filePath, _resourceHolder.ResourceContainer); }); }); }, false); if (videoResourceItem != null) { var clipartObject = VideoClipartObject.FromVideoResource(videoResourceItem); clipartObject.SourceFilePath = videoResourceItem.GetSourceFile(); var thumbnailFiles = videoResourceItem.GetThumbnailFies(); if (thumbnailFiles.Any()) { clipartObject.Thumbnail = Image.FromFile(thumbnailFiles.First()); } return(clipartObject); } return(null); }
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 LoadPreviewControl(PreviewItemControl previewControl) { if (!(previewControl.IsLoaded || previewControl.OutputItem.PreviewGeneratingAction == null)) { Utilities.ActivateForm(_parentForm.Handle, _parentForm.WindowState == FormWindowState.Maximized, true); Utilities.ActivateForm(_previewForm.Handle, _previewForm.WindowState == FormWindowState.Maximized, true); FormProgress.ShowProgress("Loading Slide Preview...", () => { previewControl.OutputItem.PreviewGeneratingAction(_mainPowerPointProcessor, previewControl.OutputItem.PresentationSourcePath); if (_previewForm.InvokeRequired) { _previewForm.BeginInvoke(new MethodInvoker(previewControl.Load)); } else { previewControl.Load(); } }, false); Utilities.ActivateForm(_parentForm.Handle, _parentForm.WindowState == FormWindowState.Maximized, false); Utilities.ActivateForm(_previewForm.Handle, _previewForm.WindowState == FormWindowState.Maximized, false); _previewForm.Opacity = 1; _previewForm.CalculateSlides(); } PreviewItemChanged?.Invoke( this, new PreviewItemChangedEventArgs { OutputItem = previewControl.OutputItem }); }
public override void InitControl(bool showSplash) { if (showSplash) { FormProgress.ShowProgress("Loading data...", DashboardInfo.LoadContentData); } else { DashboardInfo.LoadContentData(); } _slides.Add(new CleanslateControl(this)); _slides.Add(new CoverControl(this)); _slides.Add(new LeadoffStatementControl(this)); _slides.Add(new ClientGoalsControl(this)); _slides.Add(new TargetCustomersControl(this)); _slides.Add(new SimpleSummaryControl(this)); xtraTabControl.TabPages.AddRange(_slides.OfType <XtraTabPage>().ToArray()); xtraTabControl.SelectedTabPage = _slides.FirstOrDefault(); xtraTabControl.SelectedPageChanged += OnSelectedSlideChanged; foreach (var slideControl in _slides) { AssignCloseActiveEditorsOnOutsideClick(slideControl); } }
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 override void Email() { var outputItems = GetOutputItems(false); if (!outputItems.Any()) { return; } using (var form = new FormEmailFileName()) { if (form.ShowDialog() == DialogResult.OK) { Controller.Instance.ShowFloater(() => { var emailFile = String.Empty; FormProgress.ShowProgress( "Chill-Out for a few seconds...\nPreparing Email...", () => { var emailFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), String.Format("{0}-{1:MM-dd-yy-hmmss}.pdf", SolutionInfo.ToggleTitle, 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); } }); emailFile = Path.Combine( Path.GetFullPath(defaultItem.PresentationSourcePath) .Replace(Path.GetFileName(defaultItem.PresentationSourcePath), string.Empty), form.FileName + ".pptx"); File.Copy(emailFileName, emailFile, true); }, false); 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 virtual void Save(ContentSavingEventArgs savingArgs) { if (SettingsNotSaved) { Application.DoEvents(); FormProgress.ShowProgress("Saving Data...", SaveData); SettingsNotSaved = false; OnContentChanged(new ContentSavedEventArgs <TChangeInfo>(Identifier, ChangeInfo, savingArgs.SavingReason)); } }
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(); }); }
private void AddNewQuickEditSchedule() { FormProgress.ShowProgress("Building your client database...", () => { BusinessObjects.Instance.ScheduleManager.Init(); Invoke(new MethodInvoker(() => { BusinessObjects.Instance.ScheduleManager.AddQuickEditSchedule(); })); }, false); }
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); }
private void LoadData() { Application.DoEvents(); FormProgress.ShowProgress("Loading Data...", () => { ChangeInfo.Reset(); UpdateEditedContet(); }); ContentUpdateInfo.NeedToUpdate = false; ContentUpdateInfo.ChangeInfo.Reset(); }
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(); }); }
protected void Reset() { Splash(true); FormProgress.ShowProgress("Loading Data...", () => { ReleaseControls(); ActiveCalendarSection.Reset(); LoadCalendar(); }); Splash(false); SettingsNotSaved = true; }
private void OnSelectedTabPageChanging(object sender, TabPageChangingEventArgs e) { if (!(e.Page is ProductItemControl itemControl) || itemControl.Initialized) { return; } FormProgress.ShowProgress("Loading data...", () => { itemControl.InitControl(); }); }
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) { Controller.Instance.ShowFloater(() => { FormProgress.ShowProgress( "Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!", () => { outputItems.ForEach(item => item.SlideGeneratingAction?.Invoke(BusinessObjects.Instance.PowerPointManager.Processor, null)); }, false); }); }
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")); }
void miEdit_Click(object sender, EventArgs e) { FormProgress.ShowProgress("Loading action editor, please wait ..."); #if DEBUG MathNode.Trace("Loading action editor"); #endif InitializeInput(); #if DEBUG MathNode.Trace("End of InitializeInput"); #endif // OnEditAction(); FormProgress.HideProgress(); }
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(); }); }