HomePageBatesDialogViewModel.cs 24 KB

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