MainWindow.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. using ComPDFKit.Controls.Helper;
  2. using ComPDFKit.Controls.PDFControl;
  3. using ComPDFKitViewer;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Input;
  9. using System.Windows.Media.Imaging;
  10. using System.Diagnostics;
  11. using System.IO;
  12. using System.Drawing;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Linq;
  16. using System.Reflection;
  17. using System.Runtime.CompilerServices;
  18. using ComPDFKit.PDFDocument;
  19. using Microsoft.Win32;
  20. using System.Windows.Controls.Primitives;
  21. using ComPDFKit.Tool;
  22. namespace DocsEditor
  23. {
  24. public partial class MainWindow : Window, INotifyPropertyChanged
  25. {
  26. #region Property
  27. private bool isFirstLoad = true;
  28. private string currentMode = "Page Edit";
  29. private PDFViewControl passwordViewer;
  30. private PDFViewControl pdfViewControl;
  31. private CPDFAnnotationControl pdfAnnotationControl = null;
  32. private CPDFSearchControl searchControl = null;
  33. private CPDFPageEditControl pageEditControl = null;
  34. private CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
  35. private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
  36. public bool CanSave
  37. {
  38. get
  39. {
  40. if (pdfViewControl != null && pdfViewControl.PDFViewTool != null)
  41. {
  42. return pdfViewControl.PDFViewTool.IsDocumentModified;
  43. }
  44. return false;
  45. }
  46. }
  47. public event PropertyChangedEventHandler PropertyChanged;
  48. public string AppInfo
  49. {
  50. get { return Assembly.GetExecutingAssembly().GetName().Name + " " + string.Join(".", Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.').Take(3)); }
  51. }
  52. #endregion
  53. public MainWindow()
  54. {
  55. InitializeComponent();
  56. Loaded += MainWindow_Loaded;
  57. DataContext = this;
  58. }
  59. #region Load document
  60. private void LoadDefaultDocument()
  61. {
  62. string defaultFilePath = "ComPDFKit_Sample_File_Windows.pdf";
  63. LeftToolPanelButton.IsEnabled = false;
  64. SearchButton.IsEnabled = false;
  65. RightPanelButton.IsEnabled = false;
  66. ViewSettingBtn.IsEnabled = false;
  67. pdfViewControl = new PDFViewControl();
  68. pdfViewControl.InitDocument(defaultFilePath);
  69. LoadDocument();
  70. }
  71. private void LoadDocument()
  72. {
  73. if (pdfViewControl.PDFToolManager.GetDocument() == null)
  74. {
  75. return;
  76. }
  77. pdfViewControl.PDFToolManager?.SetToolType(ToolType.Viewer);
  78. if (ViewComboBox.SelectedIndex == 0)
  79. {
  80. PDFGrid.Child = pdfViewControl;
  81. }
  82. else
  83. {
  84. ToolBarContainer.Visibility = Visibility.Visible;
  85. if (pageEditControl == null)
  86. {
  87. pageEditControl = new CPDFPageEditControl();
  88. }
  89. pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
  90. pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
  91. pageEditControl.PageMoved -= PageEditControl_PageMoved;
  92. pageEditControl.PageMoved += PageEditControl_PageMoved;
  93. CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
  94. CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
  95. pageEditControl.LoadThumbnails(pdfViewControl);
  96. pageEditControl.viewControl = pdfViewControl;
  97. PDFGrid.Child = pageEditControl;
  98. FloatPageTool.Visibility = Visibility.Collapsed;
  99. }
  100. PasswordUI.Closed -= PasswordUI_Closed;
  101. PasswordUI.Canceled -= PasswordUI_Canceled;
  102. PasswordUI.Confirmed -= PasswordUI_Confirmed;
  103. PasswordUI.Closed += PasswordUI_Closed;
  104. PasswordUI.Canceled += PasswordUI_Canceled;
  105. PasswordUI.Confirmed += PasswordUI_Confirmed;
  106. pdfViewControl.PDFViewTool?.GetCPDFViewer().SetFitMode(FitMode.FitWidth);
  107. CPDFSaclingControl.InitWithPDFViewer(pdfViewControl);
  108. CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFViewTool.GetCPDFViewer().GetZoom() * 100)));
  109. ViewSettingBtn.IsChecked = false;
  110. PropertyContainer.Child = null;
  111. PropertyContainer.Visibility = Visibility.Collapsed;
  112. FloatPageTool.InitWithPDFViewer(pdfViewControl);
  113. BotaSideTool.InitWithPDFViewer(pdfViewControl);
  114. BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
  115. }
  116. #endregion
  117. #region password
  118. private void PasswordUI_Canceled(object sender, EventArgs e)
  119. {
  120. PopupBorder.Visibility = Visibility.Collapsed;
  121. PasswordUI.Visibility = Visibility.Collapsed;
  122. }
  123. private void PasswordUI_Closed(object sender, EventArgs e)
  124. {
  125. PopupBorder.Visibility = Visibility.Collapsed;
  126. PasswordUI.Visibility = Visibility.Collapsed;
  127. }
  128. private void PasswordUI_Confirmed(object sender, string e)
  129. {
  130. if (passwordViewer != null && passwordViewer.PDFToolManager != null && passwordViewer.PDFToolManager.GetDocument() != null)
  131. {
  132. passwordViewer.PDFToolManager.GetDocument().UnlockWithPassword(e);
  133. if (passwordViewer.PDFToolManager.GetDocument().IsLocked == false)
  134. {
  135. PasswordUI.SetShowError("", Visibility.Collapsed);
  136. PasswordUI.ClearPassword();
  137. PasswordUI.Visibility = Visibility.Collapsed;
  138. PopupBorder.Visibility = Visibility.Collapsed;
  139. pdfViewControl.PDFToolManager.GetDocument().Release();
  140. pdfViewControl = passwordViewer;
  141. LoadDocument();
  142. }
  143. else
  144. {
  145. PasswordUI.SetShowError("error", Visibility.Visible);
  146. }
  147. }
  148. }
  149. #endregion
  150. #region Expand and collapse Panel
  151. public void ExpandRightPropertyPanel(UIElement properytPanel, Visibility visible)
  152. {
  153. PropertyContainer.Width = 260;
  154. PropertyContainer.Child = properytPanel;
  155. PropertyContainer.Visibility = visible;
  156. if (visible == Visibility.Hidden || visible == Visibility.Collapsed)
  157. {
  158. RightPanelButton.IsChecked = false;
  159. }
  160. }
  161. private void ExpandLeftPanel(bool isExpand)
  162. {
  163. BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  164. Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  165. if (isExpand)
  166. {
  167. BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
  168. BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
  169. }
  170. else
  171. {
  172. BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
  173. BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
  174. }
  175. }
  176. #endregion
  177. #region UI
  178. private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
  179. {
  180. PasswordUI.Visibility = Visibility.Collapsed;
  181. FileInfoUI.Visibility = Visibility.Visible;
  182. FileInfoControl.InitWithPDFViewer(pdfViewControl);
  183. PopupBorder.Visibility = Visibility.Visible;
  184. }
  185. private void CPDFInfoControl_CloseInfoEvent(object sender, EventArgs e)
  186. {
  187. PopupBorder.Visibility = Visibility.Collapsed;
  188. }
  189. private void OpenFile()
  190. {
  191. string filePath = CommonHelper.GetExistedPathOrEmpty();
  192. if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
  193. {
  194. if (pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  195. {
  196. string oldFilePath = pdfViewControl.PDFToolManager.GetDocument().FilePath;
  197. if (oldFilePath.ToLower() == filePath.ToLower())
  198. {
  199. return;
  200. }
  201. else
  202. {
  203. pdfViewControl.PDFToolManager.GetDocument().Release();
  204. }
  205. }
  206. passwordViewer = new PDFViewControl();
  207. passwordViewer.InitDocument(filePath);
  208. if (passwordViewer.PDFToolManager.GetDocument() == null)
  209. {
  210. MessageBox.Show("Open File Failed");
  211. return;
  212. }
  213. if (passwordViewer.PDFToolManager.GetDocument().IsLocked)
  214. {
  215. PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " " + LanguageHelper.CommonManager.GetString("Tip_Encrypted"));
  216. PasswordUI.ClearPassword();
  217. PopupBorder.Visibility = Visibility.Visible;
  218. PasswordUI.Visibility = Visibility.Visible;
  219. }
  220. else
  221. {
  222. pdfViewControl.PDFToolManager.GetDocument().Release();
  223. pdfViewControl = passwordViewer;
  224. LoadDocument();
  225. }
  226. }
  227. }
  228. private void OpenFile_Click(object sender, RoutedEventArgs e)
  229. {
  230. OpenFile();
  231. }
  232. private void ControlLeftPanel()
  233. {
  234. if (LeftToolPanelButton != null)
  235. {
  236. bool isExpand = LeftToolPanelButton.IsChecked == true;
  237. ExpandLeftPanel(isExpand);
  238. }
  239. }
  240. private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
  241. {
  242. ControlLeftPanel();
  243. }
  244. private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
  245. {
  246. SaveFile();
  247. pdfViewControl.PDFViewTool.IsDocumentModified = false;
  248. }
  249. private void FileInfoCloseBtn_Click(object sender, RoutedEventArgs e)
  250. {
  251. PopupBorder.Visibility = Visibility.Collapsed;
  252. }
  253. private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
  254. {
  255. ExpandLeftPanel(true);
  256. LeftToolPanelButton.IsChecked = true;
  257. BotaSideTool.SelectBotaTool(BOTATools.Search);
  258. }
  259. private void ControlRightPanel()
  260. {
  261. if ((bool)ViewSettingBtn.IsChecked)
  262. {
  263. ViewSettingBtn.IsChecked = false;
  264. }
  265. if (RightPanelButton != null)
  266. {
  267. if (RightPanelButton.IsChecked == true)
  268. {
  269. ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
  270. }
  271. else
  272. {
  273. ExpandRightPropertyPanel(null, Visibility.Collapsed);
  274. }
  275. }
  276. }
  277. private void RightPanelButton_Click(object sender, RoutedEventArgs e)
  278. {
  279. ControlRightPanel();
  280. }
  281. private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
  282. {
  283. ShowViewSettings();
  284. }
  285. private double CheckZoomLevel(double zoom, bool IsGrowth)
  286. {
  287. double standardZoom = 100;
  288. if (zoom <= 0.01)
  289. {
  290. return 0.01;
  291. }
  292. if (zoom >= 10)
  293. {
  294. return 10;
  295. }
  296. zoom *= 100;
  297. for (int i = 0; i < zoomLevelList.Length - 1; i++)
  298. {
  299. if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
  300. {
  301. standardZoom = zoomLevelList[i + 1];
  302. break;
  303. }
  304. if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
  305. {
  306. standardZoom = zoomLevelList[i];
  307. break;
  308. }
  309. }
  310. return standardZoom / 100;
  311. }
  312. #endregion
  313. #region Save file
  314. /// <summary>
  315. /// Save the file to another PDF file.
  316. /// </summary>
  317. public void SaveAsFile()
  318. {
  319. {
  320. if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  321. {
  322. CPDFDocument pdfDoc = pdfViewControl.PDFToolManager.GetDocument();
  323. SaveFileDialog saveDialog = new SaveFileDialog();
  324. saveDialog.Filter = "(*.pdf)|*.pdf";
  325. saveDialog.DefaultExt = ".pdf";
  326. saveDialog.OverwritePrompt = true;
  327. if (saveDialog.ShowDialog() == true)
  328. {
  329. pdfDoc.WriteToFilePath(saveDialog.FileName);
  330. }
  331. }
  332. }
  333. }
  334. /// <summary>
  335. /// Save the file in the current path.
  336. /// </summary>
  337. private void SaveFile()
  338. {
  339. if (pdfViewControl != null && pdfViewControl.PDFToolManager != null && pdfViewControl.PDFToolManager.GetDocument() != null)
  340. {
  341. CPDFDocument pdfDoc = pdfViewControl.PDFToolManager.GetDocument();
  342. if (pdfDoc.WriteToLoadedPath())
  343. {
  344. return;
  345. }
  346. SaveFileDialog saveDialog = new SaveFileDialog();
  347. saveDialog.Filter = "(*.pdf)|*.pdf";
  348. saveDialog.DefaultExt = ".pdf";
  349. saveDialog.OverwritePrompt = true;
  350. if (saveDialog.ShowDialog() == true)
  351. {
  352. pdfDoc.WriteToFilePath(saveDialog.FileName);
  353. }
  354. }
  355. }
  356. #endregion
  357. #region Selection changed
  358. private void ViewComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  359. {
  360. if (isFirstLoad)
  361. {
  362. isFirstLoad = false;
  363. return;
  364. }
  365. var item = (sender as ComboBox).SelectedItem as ComboBoxItem;
  366. switch (currentMode)
  367. {
  368. case "Viewer":
  369. break;
  370. case "Page Edit":
  371. ToolBarContainer.Visibility = Visibility.Collapsed;
  372. pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
  373. pageEditControl.PageMoved -= PageEditControl_PageMoved;
  374. CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
  375. FloatPageTool.Visibility = Visibility.Visible;
  376. //pdfViewControl.PDFView.ReloadDocument();
  377. LeftToolPanelButton.IsEnabled = true;
  378. SearchButton.IsEnabled = true;
  379. RightPanelButton.IsEnabled = true;
  380. ViewSettingBtn.IsEnabled = true;
  381. break;
  382. default:
  383. break;
  384. }
  385. if ((string)item.Content == "Viewer")
  386. {
  387. ToolBarContainer.Visibility = Visibility.Collapsed;
  388. PDFGrid.Child = pdfViewControl;
  389. }
  390. else if ((string)item.Content == "Page Edit")
  391. {
  392. ToolBarContainer.Visibility = Visibility.Visible;
  393. if (pageEditControl == null)
  394. {
  395. pageEditControl = new CPDFPageEditControl();
  396. }
  397. pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
  398. pageEditControl.PageMoved += PageEditControl_PageMoved;
  399. CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
  400. pageEditControl.LoadThumbnails(pdfViewControl);
  401. PDFGrid.Child = pageEditControl;
  402. LeftToolPanelButton.IsChecked = false;
  403. LeftToolPanelButton.IsEnabled = false;
  404. SearchButton.IsEnabled = false;
  405. RightPanelButton.IsChecked = false;
  406. RightPanelButton.IsEnabled = false;
  407. ViewSettingBtn.IsChecked = false;
  408. ViewSettingBtn.IsEnabled = false;
  409. ExpandLeftPanel(false);
  410. ExpandRightPropertyPanel(null, Visibility.Collapsed);
  411. FloatPageTool.Visibility = Visibility.Collapsed;
  412. }
  413. currentMode = (string)item.Content;
  414. }
  415. #endregion
  416. #region Event handle
  417. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  418. {
  419. BotaSideTool.AddBOTAContent(new []{BOTATools.Thumbnail , BOTATools.Outline , BOTATools.Bookmark , BOTATools.Search});
  420. pdfAnnotationControl = new CPDFAnnotationControl();
  421. LoadDefaultDocument();
  422. }
  423. private void CPDFPageEditBarControl_PageEditEvent(object sender, string e)
  424. {
  425. pageEditControl.PageEdit(e);
  426. }
  427. private void PageEditControl_ExitPageEdit(object sender, EventArgs e)
  428. {
  429. ViewComboBox.SelectedIndex = 0;
  430. }
  431. private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
  432. {
  433. OnPropertyChanged(e.PropertyName);
  434. }
  435. private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
  436. {
  437. if (pdfViewControl == null)
  438. {
  439. return;
  440. }
  441. BotaSideTool.InitWithPDFViewer(pdfViewControl);
  442. }
  443. private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
  444. {
  445. if (e.Key == "Zoom")
  446. {
  447. CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
  448. }
  449. }
  450. #endregion
  451. #region Property changed
  452. protected void OnPropertyChanged([CallerMemberName] string name = null)
  453. {
  454. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  455. }
  456. #endregion
  457. #region Shortcut
  458. private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
  459. {
  460. OpenFile();
  461. }
  462. private void CommandBinding_Executed_Save(object sender, ExecutedRoutedEventArgs e)
  463. {
  464. if (CanSave)
  465. {
  466. SaveFile();
  467. }
  468. }
  469. private void CommandBinding_Executed_SaveAs(object sender, ExecutedRoutedEventArgs e)
  470. {
  471. SaveAsFile();
  472. }
  473. private void CommandBinding_Executed_ControlLeftPanel(object sender, ExecutedRoutedEventArgs e)
  474. {
  475. if (currentMode != "Page Edit")
  476. {
  477. LeftToolPanelButton.IsChecked = !LeftToolPanelButton.IsChecked;
  478. ControlLeftPanel();
  479. }
  480. }
  481. private void CommandBinding_Executed_ControlRightPanel(object sender, ExecutedRoutedEventArgs e)
  482. {
  483. if (currentMode != "Page Edit")
  484. {
  485. RightPanelButton.IsChecked = !RightPanelButton.IsChecked;
  486. ControlRightPanel();
  487. }
  488. }
  489. private void CommandBinding_Executed_Bookmark(object sender, ExecutedRoutedEventArgs e)
  490. {
  491. if (currentMode != "Page Edit")
  492. {
  493. ExpandLeftPanel(true);
  494. LeftToolPanelButton.IsChecked = true;
  495. BotaSideTool.SelectBotaTool(BOTATools.Bookmark);
  496. }
  497. }
  498. private void CommandBinding_Executed_Outline(object sender, ExecutedRoutedEventArgs e)
  499. {
  500. if (currentMode != "Page Edit")
  501. {
  502. ExpandLeftPanel(true);
  503. LeftToolPanelButton.IsChecked = true;
  504. BotaSideTool.SelectBotaTool(BOTATools.Outline);
  505. }
  506. }
  507. private void CommandBinding_Executed_Thumbnail(object sender, ExecutedRoutedEventArgs e)
  508. {
  509. if (currentMode != "Page Edit")
  510. {
  511. ExpandLeftPanel(true);
  512. LeftToolPanelButton.IsChecked = true;
  513. BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
  514. }
  515. }
  516. private void CommandBinding_Executed_Search(object sender, ExecutedRoutedEventArgs e)
  517. {
  518. if (currentMode != "Page Edit")
  519. {
  520. ExpandLeftPanel(true);
  521. LeftToolPanelButton.IsChecked = true;
  522. BotaSideTool.SelectBotaTool(BOTATools.Search);
  523. }
  524. }
  525. private void CommandBinding_Executed_ScaleAdd(object sender, ExecutedRoutedEventArgs e)
  526. {
  527. double newZoom = CheckZoomLevel(pdfViewControl.GetCPDFViewer().GetZoom() + 0.01, true);
  528. pdfViewControl.GetCPDFViewer().SetZoom(newZoom);
  529. }
  530. private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
  531. {
  532. double newZoom = CheckZoomLevel(pdfViewControl.GetCPDFViewer().GetZoom() - 0.01, false);
  533. pdfViewControl.GetCPDFViewer().SetZoom(newZoom);
  534. }
  535. private void ShowViewSettings()
  536. {
  537. if (ViewSettingBtn != null)
  538. {
  539. if (ViewSettingBtn.IsChecked == true)
  540. {
  541. displayPanel = new CPDFDisplaySettingsControl();
  542. displayPanel.InitWithPDFViewer(pdfViewControl);
  543. PropertyContainer.Child = displayPanel;
  544. PropertyContainer.Visibility = Visibility.Visible;
  545. if ((bool)RightPanelButton.IsChecked)
  546. {
  547. RightPanelButton.IsChecked = false;
  548. }
  549. }
  550. else
  551. {
  552. PropertyContainer.Child = null;
  553. PropertyContainer.Visibility = Visibility.Collapsed;
  554. }
  555. }
  556. }
  557. private void CommandBinding_Executed_DisplaySettings(object sender, ExecutedRoutedEventArgs e)
  558. {
  559. if (currentMode != "Page Edit")
  560. {
  561. ViewSettingBtn.IsChecked = !ViewSettingBtn.IsChecked;
  562. ShowViewSettings();
  563. }
  564. }
  565. private void CommandBinding_Executed_DocumentInfo(object sender, ExecutedRoutedEventArgs e)
  566. {
  567. if (PopupBorder.Visibility != Visibility.Visible)
  568. {
  569. PasswordUI.Visibility = Visibility.Collapsed;
  570. FileInfoUI.Visibility = Visibility.Visible;
  571. FileInfoControl.InitWithPDFViewer(pdfViewControl);
  572. PopupBorder.Visibility = Visibility.Visible;
  573. }
  574. else
  575. {
  576. FileInfoUI.Visibility = Visibility.Collapsed;
  577. PopupBorder.Visibility = Visibility.Collapsed;
  578. }
  579. }
  580. #endregion
  581. }
  582. }