HomePageBatesDialogViewModel.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. using ComPDFKit.PDFDocument;
  2. using PDF_Office.CustomControl;
  3. using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
  4. using PDF_Office.Model;
  5. using Prism.Commands;
  6. using Prism.Mvvm;
  7. using Prism.Regions;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.Diagnostics;
  12. using System.IO;
  13. using System.Linq;
  14. using PDF_Office.Helper;
  15. using System.Windows;
  16. using System.Windows.Forms;
  17. using ComPDFKitViewer.PdfViewer;
  18. using Prism.Events;
  19. using PDF_Office.EventAggregators;
  20. using PDFSettings;
  21. using ImTools;
  22. using PDF_Office.Model.EditTools.Watermark;
  23. using PDF_Office.Model.EditTools.Bates;
  24. using PDF_Office.Model.EditTools.Background;
  25. using MessageBox = System.Windows.MessageBox;
  26. using Prism.Services.Dialogs;
  27. namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBates
  28. {
  29. public class HomePageBatesDialogViewModel : BindableBase, INavigationAware
  30. {
  31. #region 参数和属性
  32. private List<string> fileNames;
  33. private CPDFDocument tempDocument;
  34. public string PageNumber = "";
  35. private CPDFBates bates;
  36. public BatesInfo BatesInfo;
  37. public IEventAggregator eventAggregator;
  38. public IRegionManager batesRegion;
  39. public IDialogService dialogs;
  40. private CPDFViewer PDFViewer;
  41. private ViewContentViewModel viewContentViewModel;
  42. public string TemplateListName = "HomePageBatesTemplateListContent";
  43. public string CreateName = "HomePageBatesCreateContent";
  44. public string BatesDocumentName = "HomePageBatesDocumentContent";
  45. public string BatesType = "HomePageBatesType";
  46. public List<int> fileNamesView = new List<int>();
  47. private int fileNamesIndex = 0;
  48. public int FileNameNumber = 0;
  49. private string _batesSettingsRegionName;
  50. /// <summary>
  51. /// 属性设置Region
  52. /// </summary>
  53. public string BatesSettingsRegionName
  54. {
  55. get { return _batesSettingsRegionName; }
  56. set { _batesSettingsRegionName = value; }
  57. }
  58. private Visibility _batesSettingsVisible = Visibility.Visible;
  59. /// <summary>
  60. /// 属性设置Region可见
  61. /// </summary>
  62. public Visibility BatesSettingsVisible
  63. {
  64. get { return _batesSettingsVisible; }
  65. set { _batesSettingsVisible = value; }
  66. }
  67. private string batesGridIsEnabled = "True";
  68. public string BatesGridIsEnabled
  69. {
  70. get
  71. {
  72. return batesGridIsEnabled;
  73. }
  74. set
  75. {
  76. SetProperty(ref batesGridIsEnabled, value);
  77. }
  78. }
  79. private string setBatesGridIsEnabled = "True";
  80. public string SetBatesGridIsEnabled
  81. {
  82. get
  83. {
  84. return setBatesGridIsEnabled;
  85. }
  86. set
  87. {
  88. SetProperty(ref setBatesGridIsEnabled, value);
  89. }
  90. }
  91. private DataTable pdfDataTable = new DataTable();
  92. public DataTable PDFDataTable
  93. {
  94. get { return pdfDataTable; }
  95. set
  96. {
  97. SetProperty(ref pdfDataTable, value);
  98. }
  99. }
  100. private DataTable pdfCurrentDataTable = new DataTable();
  101. public DataTable PDFCurrentDataTable
  102. {
  103. get { return pdfCurrentDataTable; }
  104. set
  105. {
  106. SetProperty(ref pdfCurrentDataTable, value);
  107. }
  108. }
  109. private string removeIsEnable = "False";
  110. public string RemoveIsEnable
  111. {
  112. get { return removeIsEnable; }
  113. set
  114. {
  115. SetProperty(ref removeIsEnable, value);
  116. }
  117. }
  118. private string selectFileName = "False";
  119. public string SelectFileName
  120. {
  121. get { return selectFileName; }
  122. set
  123. {
  124. SetProperty(ref selectFileName, value);
  125. }
  126. }
  127. private Visibility batesVisible = Visibility.Collapsed;
  128. public Visibility BatesVisible
  129. {
  130. get { return batesVisible; }
  131. set { SetProperty(ref batesVisible, value); }
  132. }
  133. private Visibility addFileVisibility = Visibility.Hidden;
  134. public Visibility AddFileVisibility
  135. {
  136. get { return addFileVisibility; }
  137. set
  138. {
  139. SetProperty(ref addFileVisibility, value);
  140. RaisePropertyChanged();
  141. }
  142. }
  143. private string createGridSpan = "1";
  144. public string CreateGridSpan
  145. {
  146. get { return createGridSpan; }
  147. set
  148. {
  149. SetProperty(ref createGridSpan, value);
  150. RaisePropertyChanged();
  151. }
  152. }
  153. private Visibility createGridSpanVisibility = Visibility.Visible;
  154. public Visibility CreateGridSpanVisibility
  155. {
  156. get { return createGridSpanVisibility; }
  157. set
  158. {
  159. SetProperty(ref createGridSpanVisibility, value);
  160. RaisePropertyChanged();
  161. }
  162. }
  163. #endregion
  164. #region 委托声明
  165. public DelegateCommand ADDPDFCommand { get; set; }
  166. public DelegateCommand RemovePDFFileCommand { get; set; }
  167. public DelegateCommand CreateCommand { get; set; }
  168. public DelegateCommand ADDPDFFilesCommand { get; set; }
  169. #endregion
  170. public string Unicode = null;
  171. public HomePageBatesDialogViewModel(IRegionManager batesRegion, IEventAggregator eventAggregator,IDialogService dialogs)
  172. {
  173. this.eventAggregator = eventAggregator;
  174. this.batesRegion = batesRegion;
  175. this.dialogs = dialogs;
  176. BatesSettingsRegionName = Guid.NewGuid().ToString();
  177. Unicode = Guid.NewGuid().ToString();
  178. PDFCurrentDataTable.Columns.Add("FilePageRangeText");
  179. PDFCurrentDataTable.Columns.Add("FilePageRangeSelectIndex");
  180. PDFCurrentDataTable.Columns.Add("IsEvenPageIsEnabled");
  181. PDFCurrentDataTable.Columns.Add("FileState");
  182. PDFDataTable.Columns.Add("FileName");
  183. PDFDataTable.Columns.Add("FilePageRangeText");
  184. PDFDataTable.Columns.Add("FilePageRangeSelectIndex");
  185. PDFDataTable.Columns.Add("IsEvenPageIsEnabled");
  186. PDFDataTable.Columns.Add("MaxPageRange");
  187. PDFDataTable.Columns.Add("FileSize");
  188. PDFDataTable.Columns.Add("FileState");
  189. ADDPDFCommand = new DelegateCommand(addpicture);
  190. ADDPDFFilesCommand = new DelegateCommand(addpicturefiles);
  191. RemovePDFFileCommand = new DelegateCommand(removepdffile);
  192. CreateCommand = new DelegateCommand(create);
  193. eventAggregator.GetEvent<EditBatesHeaderFooterTemplateItemEvent>().Subscribe(EditBatesTemplateItem, e => e.Unicode == Unicode && e.Type == BatesType);
  194. eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Subscribe(EnterTemplateListOrCreate, e => e.Unicode == Unicode);
  195. }
  196. #region 逻辑函数
  197. public void EditBatesTemplateItem(BatesHeaderFooterItemUnicode batesItemunicode)
  198. {
  199. BatesHeaderFooterItem batesItem = batesItemunicode.Status;
  200. NavigationParameters param = new NavigationParameters();
  201. param.Add("Unicode", Unicode);
  202. param.Add(ParameterNames.PDFViewer, PDFViewer);
  203. param.Add("BatesItem", batesItem);
  204. batesRegion.RequestNavigate(BatesSettingsRegionName, CreateName, param);
  205. BatesSettingsVisible = Visibility.Visible;
  206. CreateGridSpan = "2";
  207. CreateGridSpanVisibility = Visibility.Collapsed;
  208. }
  209. public void EnterTemplateListOrCreate(EnumTemplateListOrCreateUnicode enumTemplateListOrCreateunicode)
  210. {
  211. EnumTemplateListOrCreate enumTemplateListOrCreate = enumTemplateListOrCreateunicode.Status;
  212. if (enumTemplateListOrCreate == EnumTemplateListOrCreate.StatusTemplate)
  213. {
  214. CreateGridSpan = "1";
  215. CreateGridSpanVisibility = Visibility.Visible;
  216. EnterSelectedContent(TemplateListName);
  217. }
  218. else
  219. {
  220. CreateGridSpan = "2";
  221. CreateGridSpanVisibility = Visibility.Collapsed;
  222. EnterSelectedContent(CreateName);
  223. }
  224. }
  225. public void EnterSelectedContent(string SelectedContentName)
  226. {
  227. NavigationParameters param = new NavigationParameters();
  228. param.Add("Unicode", Unicode);
  229. param.Add(ParameterNames.PDFViewer, PDFViewer);
  230. param.Add("ViewModel", this);
  231. batesRegion.RequestNavigate(BatesSettingsRegionName, SelectedContentName, param);
  232. BatesSettingsVisible = Visibility.Visible;
  233. }
  234. private void create()
  235. {
  236. updateListview("wait");
  237. fileNamesIndex = 0;
  238. BatesGridIsEnabled = "False";
  239. foreach (var filename in fileNames)
  240. {
  241. FileInfo fileinfo = new FileInfo(filename);
  242. string OutputPath = fileinfo.DirectoryName;
  243. char[] enumerationSeparator = new char[] { ',' };
  244. char[] rangeSeparator = new char[] { '-' };
  245. List<int> PageIndexLists = new List<int>();
  246. CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
  247. if (document == null)
  248. {
  249. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "error";
  250. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "error";
  251. fileNamesIndex++;
  252. continue;
  253. }
  254. if (document.IsLocked)
  255. {
  256. DialogParameters value = new DialogParameters();
  257. value.Add(ParameterNames.PDFDocument, document);
  258. dialogs.ShowDialog(DialogNames.VerifyPassWordDialog, value, e =>
  259. {
  260. if (e.Result == ButtonResult.OK)
  261. {
  262. if (e.Parameters.ContainsKey(ParameterNames.PassWord) && e.Parameters.GetValue<string>(ParameterNames.PassWord) != null)
  263. {
  264. document.UnlockWithPassword(e.Parameters.GetValue<string>(ParameterNames.PassWord).ToString());
  265. }
  266. }
  267. });
  268. if (document.IsLocked)
  269. {
  270. //未成功解密文档时,释放Document对象,返回
  271. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "error";
  272. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "error";
  273. fileNamesIndex++;
  274. continue;
  275. }
  276. }
  277. // MessageBox.Show(filename);
  278. CreateBates(document);
  279. document.WriteToFilePath(CommonHelper.CreateFilePath(filename + "_Bates.pdf"));
  280. //if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
  281. //{ //TODO
  282. // Trace.WriteLine("输入不对");
  283. // MessageBoxEx.Show("输入不对");
  284. // return;
  285. //}
  286. document.Release();
  287. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
  288. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
  289. fileNamesIndex++;
  290. }
  291. BatesGridIsEnabled = "True";
  292. }
  293. public void CreateBates(CPDFDocument document)
  294. {
  295. if (BatesInfo != null)
  296. {
  297. if (bates != null) { bates.Release(); }
  298. bates = document.GetBates();
  299. for (int i = 0; i < 6; i++)
  300. {
  301. bates.SetText(i, BatesInfo.TextData[i].text);
  302. bates.SetFontName(i, BatesInfo.TextData[i].fontName);
  303. bates.SetFontSize(i, BatesInfo.TextData[i].fontSize);
  304. bates.SetTextColor(i, BatesInfo.TextData[i].Color);
  305. }
  306. bates.SetPageOffset(BatesInfo.StarPagetNumber + 1);
  307. bates.SetPages(getFilePageRange(document, PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"].ToString(), PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"].ToString()));
  308. bates.SetMargin(BatesInfo.margin);
  309. bates.Update();
  310. }
  311. }
  312. #endregion
  313. #region 批量处理逻辑函数
  314. /// <summary>
  315. /// 添加PDF文件
  316. /// </summary>
  317. private void addpicture()
  318. {
  319. FileNameNumber = fileNames.Count;
  320. System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
  321. dlg.Multiselect = true;
  322. dlg.Filter = "PDF|*.pdf;*.PDF;";
  323. if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  324. {
  325. fileNames.AddRange(dlg.FileNames.ToList());
  326. RemoveExcess(ref fileNames);
  327. SetBatesGridIsEnabled = "True";
  328. AddFileVisibility = Visibility.Collapsed;
  329. updateListview("wait");
  330. }
  331. }
  332. /// <summary>
  333. /// 拖拽添加PDF文件
  334. /// </summary>
  335. public void addPDFFiles(string filename)
  336. {
  337. FileNameNumber = fileNames.Count;
  338. fileNames.Add(filename);
  339. RemoveExcess(ref fileNames);
  340. SetBatesGridIsEnabled = "True";
  341. AddFileVisibility = Visibility.Collapsed;
  342. updateListview("wait");
  343. }
  344. /// <summary>
  345. /// 删除重复的文件
  346. /// </summary>
  347. public void RemoveExcess(ref List<string> Filenames)
  348. {
  349. List<string> filenames = new List<string>();
  350. foreach (var fileName in Filenames)
  351. {
  352. if (!filenames.Contains(fileName))
  353. {
  354. filenames.Add(fileName);
  355. }
  356. }
  357. Filenames.Clear();
  358. Filenames = filenames;
  359. }
  360. /// <summary>
  361. /// 添加PDF文件夹
  362. /// </summary>
  363. private void addpicturefiles()
  364. {
  365. FileNameNumber = fileNames.Count;
  366. FolderBrowserDialog dialog = new FolderBrowserDialog();
  367. dialog.Description = "请选择文件路径";
  368. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  369. {
  370. string foldPath = dialog.SelectedPath;
  371. var apps = System.IO.Directory.GetFiles(foldPath);
  372. foreach (string app in apps)
  373. {
  374. var fi = new FileInfo(app);
  375. if (fi.Extension == ".pdf" || fi.Extension == ".PDF")
  376. {
  377. fileNames.Add(app);
  378. }
  379. }
  380. RemoveExcess(ref fileNames);
  381. updateListview("wait");
  382. SetBatesGridIsEnabled = "True";
  383. AddFileVisibility = Visibility.Collapsed;
  384. }
  385. }
  386. /// <summary>
  387. /// 更新listview显示
  388. /// state 状态显示字符串
  389. /// </summary>
  390. public void updateListview(string state)
  391. {
  392. updateCurrentListview();
  393. DataTable pdfdatatable = new DataTable();
  394. pdfdatatable.Columns.Add("FileName");
  395. pdfdatatable.Columns.Add("FilePageRangeText");
  396. pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
  397. pdfdatatable.Columns.Add("IsEvenPageIsEnabled");
  398. pdfdatatable.Columns.Add("MaxPageRange");
  399. pdfdatatable.Columns.Add("FileSize");
  400. pdfdatatable.Columns.Add("FileState");
  401. int datatableindex = 0;
  402. List<int> PageIndexLists = new List<int>();
  403. foreach (var fileName in fileNames)
  404. {
  405. string file_all = fileName;
  406. FileInfo f = new FileInfo(file_all);
  407. string file_size = (((float)f.Length) / 1024).ToString() + " K";
  408. if (!isEvenPage(fileName)&& PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"].ToString()=="2") {
  409. PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"] = "0";
  410. }
  411. int pagecount = CPDFDocument.InitWithFilePath(fileName).PageCount;
  412. if (PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"].ToString() == "3" && !CommonHelper.GetPagesInRange(ref PageIndexLists, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"].ToString(), pagecount, new char[] { ',' }, new char[] { '-' },true)) {
  413. PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"] = "0";
  414. }
  415. pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], isEvenPage(fileName), pagecount, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
  416. datatableindex++;
  417. }
  418. PDFDataTable = pdfdatatable;
  419. HomePageBatchProcessingDialogModel.FilePaths = fileNames;
  420. }
  421. /// <summary>
  422. /// 更新Currentlistview显示
  423. /// pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)isevenpageisenabled 偶数页状态 state 状态显示字符串
  424. /// </summary>
  425. public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", bool isevenpageisenabled = true, string state = "wait")
  426. {
  427. if (fileNames.Count >= FileNameNumber)
  428. {
  429. for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
  430. {
  431. PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, isevenpageisenabled, state);
  432. }
  433. }
  434. else
  435. {
  436. Reverseorder(ref fileNamesView);
  437. foreach (int filenamesview in fileNamesView)
  438. {
  439. PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
  440. }
  441. }
  442. }
  443. /// <summary>
  444. /// 更新Currentlistview显示
  445. /// pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)
  446. /// </summary>
  447. public void updateFilesPageRange(string pagerangetext = "1", string pagerangeselectindex = "0")
  448. {
  449. for (int i = 0; fileNames.Count > i; i++)
  450. {
  451. PDFDataTable.Rows[i]["FilePageRangeText"] = pagerangetext;
  452. PDFDataTable.Rows[i]["FilePageRangeSelectIndex"] = pagerangeselectindex;
  453. PDFCurrentDataTable.Rows[i]["FilePageRangeText"] = pagerangetext;
  454. PDFCurrentDataTable.Rows[i]["FilePageRangeSelectIndex"] = pagerangeselectindex;
  455. }
  456. }
  457. /// <summary>
  458. /// 获取文件列表单个文件对应的页码范围
  459. /// document 文档对象 pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)
  460. /// </summary>
  461. public string getFilePageRange(CPDFDocument document, string pagerangetext = "1", string pagerangeselectindex = "0")
  462. {
  463. string filePageRange = "1";
  464. EditToolsHelper.GetPageRange(int.Parse(pagerangeselectindex), document, ref filePageRange, pagerangetext);
  465. return filePageRange;
  466. }
  467. /// <summary>
  468. /// 判断是否关闭偶数页
  469. /// document 文档对象 )
  470. /// </summary>
  471. public bool isEvenPage(string filename)
  472. {
  473. CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
  474. bool isevenpage = false;
  475. if (document.PageCount > 1)
  476. {
  477. isevenpage = true;
  478. }
  479. document.Release();
  480. return isevenpage;
  481. }
  482. /// <summary>
  483. /// 逆序int类型集合
  484. /// </summary>
  485. public void Reverseorder(ref List<int> Numbers)
  486. {
  487. Numbers = Numbers.OrderBy(a => a).ToList();
  488. Numbers.Reverse();
  489. }
  490. /// <summary>
  491. /// 打开文件PDF
  492. /// </summary>
  493. public void openfiledialog()
  494. {
  495. foreach (int filenamesview in fileNamesView)
  496. {
  497. System.Diagnostics.Process.Start(fileNames[filenamesview]);
  498. }
  499. }
  500. /// <summary>
  501. /// 删除文件PDF
  502. /// </summary>
  503. public void removepdffile()
  504. {
  505. FileNameNumber = fileNames.Count;
  506. Reverseorder(ref fileNamesView);
  507. foreach (int filenamesview in fileNamesView)
  508. {
  509. //Trace.WriteLine(filenamesview);
  510. fileNames.Remove(fileNames[filenamesview]);
  511. }
  512. if (fileNames.Count < 1)
  513. {
  514. SetBatesGridIsEnabled = "False";
  515. AddFileVisibility = Visibility.Visible;
  516. }
  517. updateListview("wait");
  518. }
  519. public void removepdffile(int index)
  520. {
  521. PDFCurrentDataTable.Rows.RemoveAt(index);
  522. fileNames.Remove(fileNames[index]);
  523. if (fileNames.Count < 1)
  524. {
  525. SetBatesGridIsEnabled = "False";
  526. AddFileVisibility = Visibility.Visible;
  527. }
  528. updateListview("wait");
  529. }
  530. public void PDFFileCount()
  531. {
  532. if (fileNames.Count == 0)
  533. {
  534. SetBatesGridIsEnabled = "False";
  535. AddFileVisibility = Visibility.Visible;
  536. }
  537. else
  538. {
  539. SetBatesGridIsEnabled = "True";
  540. AddFileVisibility = Visibility.Collapsed;
  541. }
  542. }
  543. #endregion
  544. #region 构架行为
  545. public void OnNavigatedTo(NavigationContext navigationContext)
  546. {
  547. List<string> filepath = new List<string>();
  548. navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
  549. navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
  550. navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
  551. if (filepath != null)
  552. {
  553. fileNames = filepath;
  554. CreateGridSpan = "1";
  555. CreateGridSpanVisibility = Visibility.Visible;
  556. PDFFileCount();
  557. updateListview("wait");
  558. EnterSelectedContent(TemplateListName);
  559. }
  560. }
  561. public bool IsNavigationTarget(NavigationContext navigationContext)
  562. {
  563. return true;
  564. }
  565. public void OnNavigatedFrom(NavigationContext navigationContext)
  566. {
  567. }
  568. #endregion
  569. }
  570. }