private void FormQuickView_Shown(object sender, EventArgs e) { AfterClose = null; if (PowerPointLink != null) { if (File.Exists(PowerPointLink.FullPath)) { var tempPath = Path.Combine(RemoteResourceManager.Instance.TempFolder.LocalPath, DateTime.Now.ToString("yyyyMMdd-hmmsstt") + Path.GetExtension(PowerPointLink.FullPath)); File.Copy(PowerPointLink.FullPath, tempPath, true); _tempFileCopy = new FileInfo(tempPath); } Text = "QuickView - " + PowerPointLink.NameWithExtension; laFileInfo.Text = "File Added: " + PowerPointLink.AddDate.ToString("MM/dd/yy"); var themeManager = new ThemeManager(); MainController.Instance.ProcessManager.Run("Loading Themes...", cancellationToken => themeManager.Load()); var availableThemes = themeManager.GetThemes(SlideType.SalesDepot).ToList(); if (availableThemes.Any()) { pnSlideTemplate.Visible = true; comboBoxEditSlideTemplate.Properties.Items.Clear(); comboBoxEditSlideTemplate.Properties.Items.AddRange(availableThemes); comboBoxEditSlideTemplate.SelectedIndex = 0; } else pnSlideTemplate.Visible = false; _previewData = new PresentationPreviewContainer(PowerPointLink); MainController.Instance.ProcessManager.Run("Loading Presentation...", cancellationToken => _previewData.GetPreviewImages()); comboBoxEditSlides.SelectedIndexChanged -= comboBoxEditSlides_SelectedIndexChanged; comboBoxEditSlides.Properties.Items.Clear(); comboBoxEditSlides.Properties.Items.AddRange(_previewData.Thumbnails); if (comboBoxEditSlides.Properties.Items.Count > 0) comboBoxEditSlides.SelectedIndex = 0; comboBoxEditSlides_SelectedIndexChanged(null, null); comboBoxEditSlides.SelectedIndexChanged += comboBoxEditSlides_SelectedIndexChanged; barLargeButtonItemEmail.Enabled = (MainController.Instance.Settings.EmailButtons & EmailButtonsDisplayOptionsEnum.DisplayQuickView) == EmailButtonsDisplayOptionsEnum.DisplayQuickView; } RegistryHelper.SalesDepotHandle = Handle; RegistryHelper.MaximizeSalesDepot = false; }
private void FormQuickView_Shown(object sender, EventArgs e) { if (PowerPointLink != null) { _originalFile = new FileInfo(PowerPointLink.FullPath); _viewedFile = _originalFile.CopyTo(Path.Combine(RemoteResourceManager.Instance.TempFolder.LocalPath, DateTime.Now.ToString("yyyyMMdd-hmmsstt.PPT")), true); Text = "QuickView - " + PowerPointLink.NameWithExtension; laFileInfo.Text = "File Added: " + PowerPointLink.AddDate.ToString("MM/dd/yy"); MainController.Instance.MainForm.TopMost = true; PowerPointSingleton.Instance.SetVisibility(true); _scaleK = IsLargeFont() ? 1.67 : 1.35; _previewData = new PresentationPreviewContainer(PowerPointLink); var themeManager = new ThemeManager(); MainController.Instance.ProcessManager.Run("Loading Themes...", cancellationToken => themeManager.Load()); var availableThemes = themeManager.GetThemes(SlideType.SalesDepot).ToList(); if (availableThemes.Any()) { pnSlideTemplate.Visible = true; comboBoxEditSlideTemplate.Properties.Items.Clear(); comboBoxEditSlideTemplate.Properties.Items.AddRange(availableThemes); comboBoxEditSlideTemplate.SelectedIndex = 0; } else pnSlideTemplate.Visible = false; var containerHandle = pnPreview.Handle; var containerHeight = pnPreview.Height; var containerWidth = pnPreview.Width; MainController.Instance.ProcessManager.Run("Loading the presentation...", cancellationToken => { PowerPointSingleton.Instance.OpenSlideSourcePresentation(_viewedFile); PowerPointSingleton.Instance.ViewSlideShow(); PowerPointSingleton.Instance.ResizeSlideShow( containerHandle, (int)(containerHeight / _scaleK), (int)(containerWidth / _scaleK)); }); if (PowerPointSingleton.Instance.SlideSourcePresentation != null) { comboBoxEditSlides.SelectedIndexChanged -= comboBoxEditSlides_SelectedIndexChanged; comboBoxEditSlides.Properties.Items.Clear(); for (var i = 1; i <= PowerPointSingleton.Instance.SlideSourcePresentation.Slides.Count; i++) comboBoxEditSlides.Properties.Items.Add(i.ToString()); if (comboBoxEditSlides.Properties.Items.Count > 0) comboBoxEditSlides.SelectedIndex = 0; barLargeButtonItemAddAllSlides.Enabled = comboBoxEditSlides.Properties.Items.Count > 1; comboBoxEditSlides_SelectedIndexChanged(null, null); comboBoxEditSlides.SelectedIndexChanged += comboBoxEditSlides_SelectedIndexChanged; barLargeButtonItemEmail.Enabled = (MainController.Instance.Settings.EmailButtons & EmailButtonsDisplayOptionsEnum.DisplayQuickView) == EmailButtonsDisplayOptionsEnum.DisplayQuickView; } MainController.Instance.MainForm.TopMost = false; TopMost = true; TopMost = false; } RegistryHelper.SalesDepotHandle = Handle; RegistryHelper.MaximizeSalesDepot = false; }