MainWindow.xaml.cs 22 KB

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