private void FormQuickView_Shown(object sender, EventArgs e) { if (Link != null) { Text = String.Format("Preview - {0}", Link.Name); MainController.Instance.ProcessManager.Run("Loading preview...", cancellationToken => Invoke((MethodInvoker)delegate { try { _linkViewer = LinkViewerFactory.Create(Link); } catch { _linkViewer = new CommonFileViewer(Link); } })); if (_linkViewer != null) { ((Control)_linkViewer).Visible = true; pnPreview.Controls.Add(_linkViewer as Control); } barLargeButtonItemInsert.Visibility = Link is VideoLink ? BarItemVisibility.Always : BarItemVisibility.Never; barLargeButtonItemEmail.Visibility = (MainController.Instance.Settings.EmailButtons & EmailButtonsDisplayOptionsEnum.DisplayQuickView) == EmailButtonsDisplayOptionsEnum.DisplayQuickView && Link is LibraryFileLink ? BarItemVisibility.Always : BarItemVisibility.Never; barLargeButtonItemPrint.Visibility = Link is ExcelLink || Link is DocumentLink ? BarItemVisibility.Always : BarItemVisibility.Never; barLargeButtonItemSave.Visibility = Link is LibraryFileLink ? BarItemVisibility.Always : BarItemVisibility.Never; } LinkManager.PreviousPreviewHandles.Add(RegistryHelper.SalesDepotHandle.ToInt32()); RegistryHelper.SalesDepotHandle = Handle; RegistryHelper.MaximizeSalesDepot = false; }
private void FormLinkPreview_FormClosed(object sender, FormClosedEventArgs e) { pnPreview.Controls.Clear(); _linkViewer.ReleaseResources(); _linkViewer = null; }