using System; using System.IO; using System.Windows; namespace Kingo.Plugin.MapView.Views.FeatureAttribute { /// /// UCShowFile.xaml 的交互逻辑 /// public partial class UCShowFile : KGIS.Framework.Utils.BaseWindow { public UCShowFile() { InitializeComponent(); this.Closed += UCShowFile_Closed; } private void UCShowFile_Closed(object sender, EventArgs e) { //try //{ // pdfViewer.clo //} //catch (Exception) //{ //} } public void BindData(string filePath, string extension) { try { switch (extension) { case ".xps": //Viewer.Visibility = Visibility.Visible; //pdfViewer.Visibility = Visibility.Collapsed; //Viewer.Document = new System.Windows.Xps.Packaging.XpsDocument(filePath, FileAccess.Read).GetFixedDocumentSequence(); //Viewer.FitToWidth(); break; case ".pdf": pdfViewer.OpenDocument(filePath); pdfViewer.Language = System.Windows.Markup.XmlLanguage.GetLanguage("zh-Hans"); Viewer.Visibility = Visibility.Collapsed; pdfViewer.Visibility = Visibility.Visible; break; default: throw new Exception(extension + "扩展文件不支持查看!"); } KGIS.Framework.Platform.Helper.ProgressHelper.CloseProcessBar(); } catch (Exception ex) { throw ex; } } } }