HomePageBatesDialogViewModel.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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 = App.mainWindowViewModel.SelectedItem.Unicode;
  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(ParameterNames.PDFViewer, PDFViewer);
  202. param.Add("BatesItem", batesItem);
  203. batesRegion.RequestNavigate(BatesSettingsRegionName, CreateName, param);
  204. BatesSettingsVisible = Visibility.Visible;
  205. CreateGridSpan = "2";
  206. CreateGridSpanVisibility = Visibility.Collapsed;
  207. }
  208. public void EnterTemplateListOrCreate(EnumTemplateListOrCreateUnicode enumTemplateListOrCreateunicode)
  209. {
  210. EnumTemplateListOrCreate enumTemplateListOrCreate = enumTemplateListOrCreateunicode.Status;
  211. if (enumTemplateListOrCreate == EnumTemplateListOrCreate.StatusTemplate)
  212. {
  213. CreateGridSpan = "1";
  214. CreateGridSpanVisibility = Visibility.Visible;
  215. EnterSelectedContent(TemplateListName);
  216. }
  217. else
  218. {
  219. CreateGridSpan = "2";
  220. CreateGridSpanVisibility = Visibility.Collapsed;
  221. EnterSelectedContent(CreateName);
  222. }
  223. }
  224. public void EnterSelectedContent(string SelectedContentName)
  225. {
  226. NavigationParameters param = new NavigationParameters();
  227. param.Add(ParameterNames.PDFViewer, PDFViewer);
  228. param.Add("ViewModel", this);
  229. batesRegion.RequestNavigate(BatesSettingsRegionName, SelectedContentName, param);
  230. BatesSettingsVisible = Visibility.Visible;
  231. }
  232. private void create()
  233. {
  234. updateListview("待确定");
  235. fileNamesIndex = 0;
  236. BatesGridIsEnabled = "False";
  237. foreach (var filename in fileNames)
  238. {
  239. FileInfo fileinfo = new FileInfo(filename);
  240. string OutputPath = fileinfo.DirectoryName;
  241. char[] enumerationSeparator = new char[] { ',' };
  242. char[] rangeSeparator = new char[] { '-' };
  243. List<int> PageIndexLists = new List<int>();
  244. CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
  245. if (document == null)
  246. {
  247. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
  248. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
  249. fileNamesIndex++;
  250. continue;
  251. }
  252. if (document.IsLocked)
  253. {
  254. DialogParameters value = new DialogParameters();
  255. value.Add(ParameterNames.PDFDocument, document);
  256. dialogs.ShowDialog(DialogNames.VerifyPassWordDialog, value, e =>
  257. {
  258. if (e.Result == ButtonResult.OK)
  259. {
  260. if (e.Parameters.ContainsKey(ParameterNames.PassWord) && e.Parameters.GetValue<string>(ParameterNames.PassWord) != null)
  261. {
  262. document.UnlockWithPassword(e.Parameters.GetValue<string>(ParameterNames.PassWord).ToString());
  263. }
  264. }
  265. });
  266. if (document.IsLocked)
  267. {
  268. //未成功解密文档时,释放Document对象,返回
  269. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
  270. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
  271. fileNamesIndex++;
  272. continue;
  273. }
  274. }
  275. // MessageBox.Show(filename);
  276. CreateBates(document);
  277. document.WriteToFilePath(CommonHelper.CreateFilePath(filename + "_Bates.pdf"));
  278. //if (!CommonHelper.GetPagesInRange(ref PageIndexLists, "1-" + document.PageCount.ToString(), document.PageCount, enumerationSeparator, rangeSeparator))
  279. //{ //TODO
  280. // Trace.WriteLine("输入不对");
  281. // MessageBoxEx.Show("输入不对");
  282. // return;
  283. //}
  284. document.Release();
  285. PDFDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
  286. PDFCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "完成";
  287. fileNamesIndex++;
  288. }
  289. BatesGridIsEnabled = "True";
  290. }
  291. public void CreateBates(CPDFDocument document)
  292. {
  293. if (BatesInfo != null)
  294. {
  295. if (bates != null) { bates.Release(); }
  296. bates = document.GetBates();
  297. for (int i = 0; i < 6; i++)
  298. {
  299. bates.SetText(i, BatesInfo.TextData[i].text);
  300. bates.SetFontName(i, BatesInfo.TextData[i].fontName);
  301. bates.SetFontSize(i, BatesInfo.TextData[i].fontSize);
  302. bates.SetTextColor(i, BatesInfo.TextData[i].Color);
  303. }
  304. bates.SetPageOffset(BatesInfo.StarPagetNumber + 1);
  305. bates.SetPages(getFilePageRange(document, PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeText"].ToString(), PDFCurrentDataTable.Rows[fileNamesIndex]["FilePageRangeSelectIndex"].ToString()));
  306. bates.SetMargin(BatesInfo.margin);
  307. bates.Update();
  308. }
  309. }
  310. #endregion
  311. #region 批量处理逻辑函数
  312. /// <summary>
  313. /// 添加PDF文件
  314. /// </summary>
  315. private void addpicture()
  316. {
  317. FileNameNumber = fileNames.Count;
  318. System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
  319. dlg.Multiselect = true;
  320. dlg.Filter = "PDF|*.pdf;*.PDF;";
  321. if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  322. {
  323. fileNames.AddRange(dlg.FileNames.ToList());
  324. RemoveExcess(ref fileNames);
  325. SetBatesGridIsEnabled = "True";
  326. AddFileVisibility = Visibility.Collapsed;
  327. updateListview("待确定");
  328. }
  329. }
  330. /// <summary>
  331. /// 拖拽添加PDF文件
  332. /// </summary>
  333. public void addPDFFiles(string filename)
  334. {
  335. FileNameNumber = fileNames.Count;
  336. fileNames.Add(filename);
  337. RemoveExcess(ref fileNames);
  338. SetBatesGridIsEnabled = "True";
  339. AddFileVisibility = Visibility.Collapsed;
  340. updateListview("待确定");
  341. }
  342. /// <summary>
  343. /// 删除重复的文件
  344. /// </summary>
  345. public void RemoveExcess(ref List<string> Filenames)
  346. {
  347. List<string> filenames = new List<string>();
  348. foreach (var fileName in Filenames)
  349. {
  350. if (!filenames.Contains(fileName))
  351. {
  352. filenames.Add(fileName);
  353. }
  354. }
  355. Filenames.Clear();
  356. Filenames = filenames;
  357. }
  358. /// <summary>
  359. /// 添加PDF文件夹
  360. /// </summary>
  361. private void addpicturefiles()
  362. {
  363. FileNameNumber = fileNames.Count;
  364. FolderBrowserDialog dialog = new FolderBrowserDialog();
  365. dialog.Description = "请选择文件路径";
  366. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  367. {
  368. string foldPath = dialog.SelectedPath;
  369. var apps = System.IO.Directory.GetFiles(foldPath);
  370. foreach (string app in apps)
  371. {
  372. var fi = new FileInfo(app);
  373. if (fi.Extension == ".pdf" || fi.Extension == ".PDF")
  374. {
  375. fileNames.Add(app);
  376. }
  377. }
  378. RemoveExcess(ref fileNames);
  379. updateListview("待确定");
  380. SetBatesGridIsEnabled = "True";
  381. AddFileVisibility = Visibility.Collapsed;
  382. }
  383. }
  384. /// <summary>
  385. /// 更新listview显示
  386. /// state 状态显示字符串
  387. /// </summary>
  388. public void updateListview(string state)
  389. {
  390. updateCurrentListview();
  391. DataTable pdfdatatable = new DataTable();
  392. pdfdatatable.Columns.Add("FileName");
  393. pdfdatatable.Columns.Add("FilePageRangeText");
  394. pdfdatatable.Columns.Add("FilePageRangeSelectIndex");
  395. pdfdatatable.Columns.Add("IsEvenPageIsEnabled");
  396. pdfdatatable.Columns.Add("MaxPageRange");
  397. pdfdatatable.Columns.Add("FileSize");
  398. pdfdatatable.Columns.Add("FileState");
  399. int datatableindex = 0;
  400. List<int> PageIndexLists = new List<int>();
  401. foreach (var fileName in fileNames)
  402. {
  403. string file_all = fileName;
  404. FileInfo f = new FileInfo(file_all);
  405. string file_size = (((float)f.Length) / 1024).ToString() + " K";
  406. if (!isEvenPage(fileName)&& PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"].ToString()=="2") {
  407. PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"] = "0";
  408. }
  409. int pagecount = CPDFDocument.InitWithFilePath(fileName).PageCount;
  410. if (PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"].ToString() == "3" && !CommonHelper.GetPagesInRange(ref PageIndexLists, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"].ToString(), pagecount, new char[] { ',' }, new char[] { '-' },true)) {
  411. PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"] = "0";
  412. }
  413. pdfdatatable.Rows.Add(f.Name, PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeText"], PDFCurrentDataTable.Rows[datatableindex]["FilePageRangeSelectIndex"], isEvenPage(fileName), pagecount, file_size, PDFCurrentDataTable.Rows[datatableindex]["FileState"]);
  414. datatableindex++;
  415. }
  416. PDFDataTable = pdfdatatable;
  417. HomePageBatchProcessingDialogModel.FilePaths = fileNames;
  418. }
  419. /// <summary>
  420. /// 更新Currentlistview显示
  421. /// pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)isevenpageisenabled 偶数页状态 state 状态显示字符串
  422. /// </summary>
  423. public void updateCurrentListview(string pagerangetext = "1", string pagerangeselectindex = "0", bool isevenpageisenabled = true, string state = "待完成")
  424. {
  425. if (fileNames.Count >= FileNameNumber)
  426. {
  427. for (int i = 0; fileNames.Count - FileNameNumber > i; i++)
  428. {
  429. PDFCurrentDataTable.Rows.Add(pagerangetext, pagerangeselectindex, isevenpageisenabled, state);
  430. }
  431. }
  432. else
  433. {
  434. Reverseorder(ref fileNamesView);
  435. foreach (int filenamesview in fileNamesView)
  436. {
  437. PDFCurrentDataTable.Rows.RemoveAt(filenamesview);
  438. }
  439. }
  440. }
  441. /// <summary>
  442. /// 更新Currentlistview显示
  443. /// pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)
  444. /// </summary>
  445. public void updateFilesPageRange(string pagerangetext = "1", string pagerangeselectindex = "0")
  446. {
  447. for (int i = 0; fileNames.Count > i; i++)
  448. {
  449. PDFDataTable.Rows[i]["FilePageRangeText"] = pagerangetext;
  450. PDFDataTable.Rows[i]["FilePageRangeSelectIndex"] = pagerangeselectindex;
  451. PDFCurrentDataTable.Rows[i]["FilePageRangeText"] = pagerangetext;
  452. PDFCurrentDataTable.Rows[i]["FilePageRangeSelectIndex"] = pagerangeselectindex;
  453. }
  454. }
  455. /// <summary>
  456. /// 获取文件列表单个文件对应的页码范围
  457. /// document 文档对象 pagerangetext 自定义页面范围字符串 pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)
  458. /// </summary>
  459. public string getFilePageRange(CPDFDocument document, string pagerangetext = "1", string pagerangeselectindex = "0")
  460. {
  461. string filePageRange = "1";
  462. EditToolsHelper.GetPageRange(int.Parse(pagerangeselectindex), document, ref filePageRange, pagerangetext);
  463. return filePageRange;
  464. }
  465. /// <summary>
  466. /// 判断是否关闭偶数页
  467. /// document 文档对象 )
  468. /// </summary>
  469. public bool isEvenPage(string filename)
  470. {
  471. CPDFDocument document = CPDFDocument.InitWithFilePath(filename);
  472. bool isevenpage = false;
  473. if (document.PageCount > 1)
  474. {
  475. isevenpage = true;
  476. }
  477. document.Release();
  478. return isevenpage;
  479. }
  480. /// <summary>
  481. /// 逆序int类型集合
  482. /// </summary>
  483. public void Reverseorder(ref List<int> Numbers)
  484. {
  485. Numbers = Numbers.OrderBy(a => a).ToList();
  486. Numbers.Reverse();
  487. }
  488. /// <summary>
  489. /// 打开文件PDF
  490. /// </summary>
  491. public void openfiledialog()
  492. {
  493. foreach (int filenamesview in fileNamesView)
  494. {
  495. System.Diagnostics.Process.Start(fileNames[filenamesview]);
  496. }
  497. }
  498. /// <summary>
  499. /// 删除文件PDF
  500. /// </summary>
  501. public void removepdffile()
  502. {
  503. FileNameNumber = fileNames.Count;
  504. Reverseorder(ref fileNamesView);
  505. foreach (int filenamesview in fileNamesView)
  506. {
  507. //Trace.WriteLine(filenamesview);
  508. fileNames.Remove(fileNames[filenamesview]);
  509. }
  510. if (fileNames.Count < 1)
  511. {
  512. SetBatesGridIsEnabled = "False";
  513. AddFileVisibility = Visibility.Visible;
  514. }
  515. updateListview("待确定");
  516. }
  517. public void removepdffile(int index)
  518. {
  519. PDFCurrentDataTable.Rows.RemoveAt(index);
  520. fileNames.Remove(fileNames[index]);
  521. if (fileNames.Count < 1)
  522. {
  523. SetBatesGridIsEnabled = "False";
  524. AddFileVisibility = Visibility.Visible;
  525. }
  526. updateListview("待确定");
  527. }
  528. public void PDFFileCount()
  529. {
  530. if (fileNames.Count == 0)
  531. {
  532. SetBatesGridIsEnabled = "False";
  533. AddFileVisibility = Visibility.Visible;
  534. }
  535. else
  536. {
  537. SetBatesGridIsEnabled = "True";
  538. AddFileVisibility = Visibility.Collapsed;
  539. }
  540. }
  541. #endregion
  542. #region 构架行为
  543. public void OnNavigatedTo(NavigationContext navigationContext)
  544. {
  545. List<string> filepath = new List<string>();
  546. navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
  547. navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
  548. navigationContext.Parameters.TryGetValue<List<string>>(ParameterNames.FilePath, out filepath);
  549. if (filepath != null)
  550. {
  551. fileNames = filepath;
  552. CreateGridSpan = "1";
  553. CreateGridSpanVisibility = Visibility.Visible;
  554. PDFFileCount();
  555. updateListview("待确定");
  556. EnterSelectedContent(TemplateListName);
  557. }
  558. }
  559. public bool IsNavigationTarget(NavigationContext navigationContext)
  560. {
  561. return true;
  562. }
  563. public void OnNavigatedFrom(NavigationContext navigationContext)
  564. {
  565. }
  566. #endregion
  567. }
  568. }