MainWindow.xaml.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. using ComPDFKit.PDFDocument;
  2. using Compdfkit_Tools.Helper;
  3. using Compdfkit_Tools.PDFControl;
  4. using ComPDFKitViewer;
  5. using Microsoft.Win32;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Diagnostics;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Reflection;
  14. using System.Runtime.CompilerServices;
  15. using System.Windows;
  16. using System.Windows.Controls;
  17. using System.Windows.Controls.Primitives;
  18. using System.Windows.Input;
  19. using System.Windows.Media.Imaging;
  20. using ComPDFKit.PDFPage;
  21. using ComPDFKit.Tool;
  22. namespace Viewer
  23. {
  24. /// <summary>
  25. /// Interaction logic for MainWindow.xaml
  26. /// </summary>
  27. public partial class MainWindow : Window, INotifyPropertyChanged
  28. {
  29. #region Property
  30. private PDFViewControl passwordViewer;
  31. private PDFViewControl pdfViewControl;
  32. CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
  33. private int[] zoomLevelList = { 10, 25, 50, 100, 150, 200, 300, 400, 500, 1000 };
  34. public event PropertyChangedEventHandler PropertyChanged;
  35. private KeyEventHandler KeyDownHandler;
  36. public bool CanSave
  37. {
  38. get
  39. {
  40. if (pdfViewControl != null && pdfViewControl.PDFViewTool.GetCPDFViewer() != null)
  41. {
  42. if (pdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanRedo ||
  43. pdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanUndo)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. }
  51. public string AppInfo
  52. {
  53. get { return Assembly.GetExecutingAssembly().GetName().Name + " " + string.Join(".", Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.').Take(3)); }
  54. }
  55. #endregion
  56. public MainWindow()
  57. {
  58. InitializeComponent();
  59. Loaded += MainWindow_Loaded;
  60. DataContext = this;
  61. }
  62. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  63. {
  64. BotaSideTool.AddBOTAContent(new[] { BOTATools.Thumbnail, BOTATools.Outline, BOTATools.Bookmark, BOTATools.Search });
  65. LoadDefaultDocument();
  66. }
  67. #region Load Document
  68. private void LoadDocument()
  69. {
  70. if (pdfViewControl.PDFToolManager.GetDocument() == null)
  71. {
  72. return;
  73. }
  74. pdfViewControl.PDFToolManager?.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.Viewer);
  75. PDFGrid.Child = pdfViewControl;
  76. PasswordUI.Closed -= PasswordUI_Closed;
  77. PasswordUI.Canceled -= PasswordUI_Canceled;
  78. PasswordUI.Confirmed -= PasswordUI_Confirmed;
  79. PasswordUI.Closed += PasswordUI_Closed;
  80. PasswordUI.Canceled += PasswordUI_Canceled;
  81. PasswordUI.Confirmed += PasswordUI_Confirmed;
  82. pdfViewControl.MouseRightButtonDownHandler -= PDFViewControl_MouseRightButtonDownHandler;
  83. pdfViewControl.MouseRightButtonDownHandler += PDFViewControl_MouseRightButtonDownHandler;
  84. pdfViewControl.PDFViewTool.GetCPDFViewer().SetFitMode(FitMode.FitWidth);
  85. CPDFSaclingControl.InitWithPDFViewer(pdfViewControl);
  86. CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() * 100)));
  87. FloatPageTool.InitWithPDFViewer(pdfViewControl);
  88. BotaSideTool.InitWithPDFViewer(pdfViewControl);
  89. BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
  90. ViewSettingBtn.IsChecked = false;
  91. PropertyContainer.Child = null;
  92. PropertyContainer.Visibility = Visibility.Collapsed;
  93. }
  94. private void LoadDefaultDocument()
  95. {
  96. string defaultFilePath = "ComPDFKit_Sample_File_Windows.pdf";
  97. pdfViewControl = new PDFViewControl();
  98. pdfViewControl.InitDocument(defaultFilePath);
  99. LoadDocument();
  100. }
  101. #endregion
  102. #region Password
  103. private void PasswordUI_Confirmed(object sender, string e)
  104. {
  105. if (passwordViewer != null && passwordViewer.PDFToolManager != null && passwordViewer.PDFToolManager.GetDocument() != null)
  106. {
  107. passwordViewer.PDFToolManager.GetDocument().UnlockWithPassword(e);
  108. if (passwordViewer.PDFToolManager.GetDocument().IsLocked == false)
  109. {
  110. PasswordUI.SetShowError("", Visibility.Collapsed);
  111. PasswordUI.ClearPassword();
  112. PasswordUI.Visibility = Visibility.Collapsed;
  113. PopupBorder.Visibility = Visibility.Collapsed;
  114. pdfViewControl = passwordViewer;
  115. LoadDocument();
  116. }
  117. else
  118. {
  119. PasswordUI.SetShowError("Wrong Password", Visibility.Visible);
  120. }
  121. }
  122. }
  123. private void PasswordUI_Canceled(object sender, EventArgs e)
  124. {
  125. PopupBorder.Visibility = Visibility.Collapsed;
  126. PasswordUI.Visibility = Visibility.Collapsed;
  127. }
  128. private void PasswordUI_Closed(object sender, EventArgs e)
  129. {
  130. PopupBorder.Visibility = Visibility.Collapsed;
  131. PasswordUI.Visibility = Visibility.Collapsed;
  132. }
  133. #endregion
  134. #region Expand or Hide Panel
  135. private void ControlLeftPanel()
  136. {
  137. if (LeftToolPanelButton != null)
  138. {
  139. bool isExpand = LeftToolPanelButton.IsChecked == true;
  140. ExpandLeftPanel(isExpand);
  141. }
  142. }
  143. private void ExpandLeftPanel(bool isExpand)
  144. {
  145. BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  146. Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  147. if (isExpand)
  148. {
  149. BodyGrid.ColumnDefinitions[0].Width = new GridLength(260);
  150. BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
  151. }
  152. else
  153. {
  154. BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
  155. BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
  156. }
  157. }
  158. private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
  159. {
  160. ExpandLeftPanel(true);
  161. BotaSideTool.SelectBotaTool(BOTATools.Search);
  162. }
  163. private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
  164. {
  165. ToggleButton expandBtn = sender as ToggleButton;
  166. if (expandBtn != null)
  167. {
  168. bool isExpand = expandBtn.IsChecked == true;
  169. ExpandLeftPanel(isExpand);
  170. }
  171. }
  172. #endregion
  173. #region UI
  174. private double CheckZoomLevel(double zoom, bool IsGrowth)
  175. {
  176. double standardZoom = 100;
  177. if (zoom <= 0.01)
  178. {
  179. return 0.01;
  180. }
  181. if (zoom >= 10)
  182. {
  183. return 10;
  184. }
  185. zoom *= 100;
  186. for (int i = 0; i < zoomLevelList.Length - 1; i++)
  187. {
  188. if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
  189. {
  190. standardZoom = zoomLevelList[i + 1];
  191. break;
  192. }
  193. if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
  194. {
  195. standardZoom = zoomLevelList[i];
  196. break;
  197. }
  198. }
  199. return standardZoom / 100;
  200. }
  201. private void ShowViewSettings()
  202. {
  203. if (ViewSettingBtn != null)
  204. {
  205. if (ViewSettingBtn.IsChecked == true)
  206. {
  207. displayPanel.InitWithPDFViewer(pdfViewControl);
  208. PropertyContainer.Child = displayPanel;
  209. PropertyContainer.Visibility = Visibility.Visible;
  210. }
  211. else
  212. {
  213. PropertyContainer.Child = null;
  214. PropertyContainer.Visibility = Visibility.Collapsed;
  215. }
  216. }
  217. }
  218. private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
  219. {
  220. ShowViewSettings();
  221. }
  222. private void ZoomInBtn_Click(object sender, RoutedEventArgs e)
  223. {
  224. if (pdfViewControl != null)
  225. {
  226. double newZoom = CheckZoomLevel(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() + 0.01, true);
  227. pdfViewControl.PDFViewTool.GetCPDFViewer().SetZoom(newZoom);
  228. }
  229. }
  230. private void ZoomOutBtn_Click(object sender, RoutedEventArgs e)
  231. {
  232. if (pdfViewControl != null)
  233. {
  234. double newZoom = CheckZoomLevel(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() - 0.01, false);
  235. pdfViewControl.PDFViewTool.GetCPDFViewer().SetZoom(newZoom);
  236. }
  237. }
  238. private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  239. {
  240. pdfViewControl.PDFViewTool.GetCPDFViewer()?.GoToPage(pdfViewControl.PDFViewTool.GetCPDFViewer().CurrentRenderFrame.PageIndex + 1,new System.Windows.Point(0,0));
  241. }
  242. private void PrevPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  243. {
  244. pdfViewControl.PDFViewTool.GetCPDFViewer()?.GoToPage(pdfViewControl.PDFViewTool.GetCPDFViewer().CurrentRenderFrame.PageIndex - 1, new System.Windows.Point(0, 0));
  245. }
  246. private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
  247. {
  248. PasswordUI.Visibility = Visibility.Collapsed;
  249. FileInfoUI.Visibility = Visibility.Visible;
  250. FileInfoControl.InitWithPDFViewer(pdfViewControl);
  251. PopupBorder.Visibility = Visibility.Visible;
  252. }
  253. private void FileInfoCloseBtn_Click(object sender, RoutedEventArgs e)
  254. {
  255. PopupBorder.Visibility = Visibility.Collapsed;
  256. }
  257. #endregion
  258. #region Open and save file
  259. /// <summary>
  260. /// Save the file to another PDF file.
  261. /// </summary>
  262. public void SaveAsFile()
  263. {
  264. {
  265. if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  266. {
  267. CPDFDocument pdfDoc = pdfViewControl.PDFToolManager.GetDocument();
  268. SaveFileDialog saveDialog = new SaveFileDialog();
  269. saveDialog.Filter = "(*.pdf)|*.pdf";
  270. saveDialog.DefaultExt = ".pdf";
  271. saveDialog.OverwritePrompt = true;
  272. if (saveDialog.ShowDialog() == true)
  273. {
  274. pdfDoc.WriteToFilePath(saveDialog.FileName);
  275. }
  276. }
  277. }
  278. }
  279. private void SaveFile()
  280. {
  281. if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  282. {
  283. CPDFDocument pdfDoc = pdfViewControl.PDFToolManager.GetDocument();
  284. if (pdfDoc.WriteToLoadedPath())
  285. {
  286. pdfViewControl.PDFViewTool.IsDocumentModified = false;
  287. return;
  288. }
  289. SaveFileDialog saveDialog = new SaveFileDialog();
  290. saveDialog.Filter = "(*.pdf)|*.pdf";
  291. saveDialog.DefaultExt = ".pdf";
  292. saveDialog.OverwritePrompt = true;
  293. if (saveDialog.ShowDialog() == true)
  294. {
  295. if (pdfDoc.WriteToFilePath(saveDialog.FileName))
  296. {
  297. pdfViewControl.PDFViewTool.IsDocumentModified = false;
  298. }
  299. }
  300. }
  301. }
  302. private void OpenFile()
  303. {
  304. string filePath = CommonHelper.GetExistedPathOrEmpty();
  305. if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
  306. {
  307. if (pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  308. {
  309. string oldFilePath = pdfViewControl.PDFToolManager.GetDocument().FilePath;
  310. if (oldFilePath.ToLower() == filePath.ToLower())
  311. {
  312. return;
  313. }
  314. }
  315. passwordViewer = new PDFViewControl();
  316. passwordViewer.InitDocument(filePath);
  317. if (passwordViewer.PDFToolManager.GetDocument() == null)
  318. {
  319. MessageBox.Show("Open File Failed");
  320. return;
  321. }
  322. if (passwordViewer.PDFToolManager.GetDocument().IsLocked)
  323. {
  324. PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " " + LanguageHelper.CommonManager.GetString("Tip_Encrypted"));
  325. PasswordUI.ClearPassword();
  326. PopupBorder.Visibility = Visibility.Visible;
  327. PasswordUI.Visibility = Visibility.Visible;
  328. }
  329. else
  330. {
  331. pdfViewControl.PDFToolManager.GetDocument().Release();
  332. pdfViewControl = passwordViewer;
  333. LoadDocument();
  334. }
  335. }
  336. }
  337. private void OpenFile_Click(object sender, RoutedEventArgs e)
  338. {
  339. OpenFile();
  340. }
  341. private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
  342. {
  343. SaveFile();
  344. }
  345. #endregion
  346. #region Context Menu
  347. private void ExtractImage_Click(object sender, RoutedEventArgs e)
  348. {
  349. System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
  350. if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  351. {
  352. var image = pdfViewControl.FocusPDFViewTool.GetSelectImage();
  353. if(image == null)
  354. {
  355. return;
  356. }
  357. CPDFPage page = pdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  358. string savePath = Path.Combine(folderDialog.SelectedPath, Guid.NewGuid() + ".jpg");
  359. string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  360. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  361. Bitmap bitmap = new Bitmap(tempPath);
  362. bitmap.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
  363. Process.Start("explorer", "/select,\"" + savePath + "\"");
  364. }
  365. }
  366. private void CopyImage_Click(object sender, RoutedEventArgs e)
  367. {
  368. var image = pdfViewControl.FocusPDFViewTool.GetSelectImage();
  369. if(image == null)
  370. {
  371. return;
  372. }
  373. CPDFPage page = pdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  374. string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  375. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  376. Bitmap bitmap = new Bitmap(tempPath);
  377. BitmapImage imageData;
  378. using (MemoryStream ms = new MemoryStream())
  379. {
  380. bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
  381. imageData = new BitmapImage();
  382. imageData.BeginInit();
  383. imageData.StreamSource = ms;
  384. imageData.CacheOption = BitmapCacheOption.OnLoad;
  385. imageData.EndInit();
  386. imageData.Freeze();
  387. Clipboard.SetImage(imageData);
  388. bitmap.Dispose();
  389. File.Delete(tempPath);
  390. }
  391. }
  392. private void CreateImageContextMenu(object sender, ref ContextMenu menu)
  393. {
  394. if (menu == null)
  395. {
  396. menu = new ContextMenu();
  397. }
  398. MenuItem copyImage = new MenuItem();
  399. copyImage.Header = "Copy Image";
  400. copyImage.Click += CopyImage_Click;
  401. menu.Items.Add(copyImage);
  402. MenuItem extractImage = new MenuItem();
  403. extractImage.Header = "Extract Image";
  404. extractImage.Click += ExtractImage_Click;
  405. menu.Items.Add(extractImage);
  406. }
  407. private void PDFViewControl_MouseRightButtonDownHandler(object sender, ComPDFKit.Tool.MouseEventObject e)
  408. {
  409. ContextMenu menu = pdfViewControl.GetRightMenu();
  410. if (menu == null)
  411. {
  412. menu = new ContextMenu();
  413. }
  414. switch (e.hitTestType)
  415. {
  416. case MouseHitTestType.ImageSelect:
  417. CreateImageContextMenu(sender, ref menu);
  418. break;
  419. default:
  420. pdfViewControl.CreateViewerMenu(sender,ref menu);
  421. break;
  422. }
  423. pdfViewControl.SetRightMenu(menu);
  424. }
  425. #endregion
  426. #region Close Window
  427. protected override void OnClosing(CancelEventArgs e)
  428. {
  429. if (pdfViewControl.PDFViewTool.IsDocumentModified)
  430. {
  431. MessageBoxResult result = MessageBox.Show("Do you want to save your changes before closing the application?", "Message", MessageBoxButton.YesNoCancel);
  432. if (result == MessageBoxResult.Yes)
  433. {
  434. SaveFile();
  435. }
  436. else if (result == MessageBoxResult.No)
  437. {
  438. }
  439. else
  440. {
  441. e.Cancel = true;
  442. }
  443. }
  444. }
  445. #endregion
  446. #region PropertyChanged
  447. /// <summary>
  448. /// Zoom
  449. /// </summary>
  450. private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
  451. {
  452. if (e.Key == "Zoom")
  453. {
  454. CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
  455. }
  456. }
  457. /// <summary>
  458. /// Undo Redo Event Noitfy
  459. /// </summary>
  460. private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
  461. {
  462. OnPropertyChanged(e.PropertyName);
  463. }
  464. protected void OnPropertyChanged([CallerMemberName] string name = null)
  465. {
  466. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  467. }
  468. #endregion
  469. #region Shortcut
  470. private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
  471. {
  472. OpenFile();
  473. }
  474. private void CommandBinding_Executed_Save(object sender, ExecutedRoutedEventArgs e)
  475. {
  476. if (CanSave)
  477. {
  478. SaveFile();
  479. }
  480. }
  481. private void CommandBinding_Executed_SaveAs(object sender, ExecutedRoutedEventArgs e)
  482. {
  483. SaveAsFile();
  484. }
  485. private void CommandBinding_Executed_ControlLeftPanel(object sender, ExecutedRoutedEventArgs e)
  486. {
  487. LeftToolPanelButton.IsChecked = !LeftToolPanelButton.IsChecked;
  488. ControlLeftPanel();
  489. }
  490. private void CommandBinding_Executed_Bookmark(object sender, ExecutedRoutedEventArgs e)
  491. {
  492. ExpandLeftPanel(true);
  493. LeftToolPanelButton.IsChecked = true;
  494. BotaSideTool.SelectBotaTool(BOTATools.Bookmark);
  495. }
  496. private void CommandBinding_Executed_Outline(object sender, ExecutedRoutedEventArgs e)
  497. {
  498. ExpandLeftPanel(true);
  499. LeftToolPanelButton.IsChecked = true;
  500. BotaSideTool.SelectBotaTool(BOTATools.Outline);
  501. }
  502. private void CommandBinding_Executed_Thumbnail(object sender, ExecutedRoutedEventArgs e)
  503. {
  504. ExpandLeftPanel(true);
  505. LeftToolPanelButton.IsChecked = true;
  506. BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
  507. }
  508. private void CommandBinding_Executed_Search(object sender, ExecutedRoutedEventArgs e)
  509. {
  510. ExpandLeftPanel(true);
  511. LeftToolPanelButton.IsChecked = true;
  512. BotaSideTool.SelectBotaTool(BOTATools.Search);
  513. }
  514. private void CommandBinding_Executed_ScaleAdd(object sender, ExecutedRoutedEventArgs e)
  515. {
  516. //double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
  517. //pdfViewControl.PDFView?.Zoom(newZoom);
  518. }
  519. private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
  520. {
  521. //double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
  522. //pdfViewControl.PDFView?.Zoom(newZoom);
  523. }
  524. private void CommandBinding_Executed_DisplaySettings(object sender, ExecutedRoutedEventArgs e)
  525. {
  526. ViewSettingBtn.IsChecked = !ViewSettingBtn.IsChecked;
  527. ShowViewSettings();
  528. }
  529. private void CommandBinding_Executed_DocumentInfo(object sender, ExecutedRoutedEventArgs e)
  530. {
  531. if (PopupBorder.Visibility != Visibility.Visible)
  532. {
  533. PasswordUI.Visibility = Visibility.Collapsed;
  534. FileInfoUI.Visibility = Visibility.Visible;
  535. FileInfoControl.InitWithPDFViewer(pdfViewControl);
  536. PopupBorder.Visibility = Visibility.Visible;
  537. }
  538. else
  539. {
  540. FileInfoUI.Visibility = Visibility.Collapsed;
  541. PopupBorder.Visibility = Visibility.Collapsed;
  542. }
  543. }
  544. #endregion
  545. }
  546. }