private void setPreview() { Application.DoEvents(); progressBar.Visible = false; buttonSave.Enabled = true; buttonOpen.Enabled = true; if (!OsUtility.IsWinXP()) { try { Cursor = Cursors.WaitCursor; string _file = Main.GCONST.CachePath + m_currentAttachment.object_id + m_currentAttachment.file_name; //HttpUtility.UrlDecode(m_currentAttachment.file_name) string _destFile = Main.GCONST.TempPath + DateTime.Now.ToString("yyyyMMddHHmmssff") + "_" + m_currentAttachment.file_name; //HttpUtility.UrlDecode(m_currentAttachment.file_name) File.Copy(_file, _destFile); previewHandlerHost.Open(_destFile); } catch { } finally { Cursor = Cursors.Default; } } Application.DoEvents(); }
public FrameworkElement GetElement(string fileName) { var maxWidth = SystemParameters.WorkArea.Width - 100; var maxHeight = SystemParameters.WorkArea.Height - 100; var previewHandlerHost = new PreviewHandlerHost(); var windowsFormsHost = new WindowsFormsHost(); windowsFormsHost.BeginInit(); windowsFormsHost.Child = previewHandlerHost; windowsFormsHost.Width = maxWidth / 1.5; windowsFormsHost.Height = maxHeight / 1.5; windowsFormsHost.EndInit(); previewHandlerHost.Open(fileName); return(windowsFormsHost); }
public FrameworkElement GetElement(string fileName) { var maxWidth = SystemParameters.WorkArea.Width - 100; var maxHeight = SystemParameters.WorkArea.Height - 100; var previewHandlerHost = new PreviewHandlerHost(); var windowsFormsHost = new WindowsFormsHost(); windowsFormsHost.BeginInit(); windowsFormsHost.Child = previewHandlerHost; windowsFormsHost.Width = maxWidth / 1.5; windowsFormsHost.Height = maxHeight / 1.5; windowsFormsHost.EndInit(); previewHandlerHost.Open(fileName); return windowsFormsHost; }
public (FrameworkElement, Size, string) GetViewer(FileInfo fileInfo) { var requestSize = new Size { Width = 1200, Height = 900 }; var previewHandlerHost = new PreviewHandlerHost(); var windowsFormsHost = new WindowsFormsHost(); windowsFormsHost.BeginInit(); windowsFormsHost.Child = previewHandlerHost; windowsFormsHost.EndInit(); previewHandlerHost.Open(fileInfo.FullName); return(windowsFormsHost, requestSize, WinExplorerHelper.GetSizeFormat(fileInfo.Length)); }