MergeDialogViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. using ComPDFKit.PDFDocument;
  2. using ComPDFKit.PDFPage;
  3. using ComPDFKitViewer.PdfViewer;
  4. using Dropbox.Api.TeamLog;
  5. using Microsoft.Office.Interop.Word;
  6. using Microsoft.Win32;
  7. using PDF_Master.CustomControl;
  8. using PDF_Master.EventAggregators;
  9. using PDF_Master.Helper;
  10. using PDF_Master.Model;
  11. using PDF_Master.Model.Dialog.ToolsDialogs;
  12. using PDF_Master.Properties;
  13. using PDF_Master.Views.Dialog;
  14. using Prism.Commands;
  15. using Prism.Events;
  16. using Prism.Mvvm;
  17. using Prism.Services.Dialogs;
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Collections.ObjectModel;
  21. using System.IO;
  22. using System.Linq;
  23. using System.Reflection;
  24. using System.Text;
  25. using System.Threading.Tasks;
  26. using System.Windows;
  27. using System.Windows.Controls;
  28. using System.Windows.Media;
  29. using System.Windows.Media.Imaging;
  30. using static Dropbox.Api.TeamLog.PaperDownloadFormat;
  31. using static PDF_Master.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
  32. namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
  33. {
  34. class MergeDialogViewModel : BindableBase, IDialogAware
  35. {
  36. // Fix:存储当前程序加载的文档的路径和tag,
  37. //如果路径相同则用tag里的密码解锁,
  38. //解锁失败再另行提权
  39. private string CurrentFilePath = string.Empty;
  40. private string currentLoadedPassword = string.Empty;
  41. private IEventAggregator eventAggregator;
  42. enum PageSizeType
  43. {
  44. kDefault = 0,
  45. A4 = 1,
  46. A3 = 2,
  47. Letter = 3,
  48. Legal = 4,
  49. Customized = 5,
  50. }
  51. #region 框架内容
  52. public string Title => "";
  53. public event Action<IDialogResult> RequestClose;
  54. public bool CanCloseDialog()
  55. {
  56. return true;
  57. }
  58. public void OnDialogClosed()
  59. {
  60. }
  61. public void OnDialogOpened(IDialogParameters parameters)
  62. {
  63. CPDFViewer pdfViewer = null;
  64. if (parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer) && pdfViewer != null && pdfViewer.Document != null)
  65. {
  66. VerifyPasswordResult condition = SecurityHelper.VerifyPasswordByPasswordKind(pdfViewer.Document, EnumPasswordKind.StatusPermissionsPassword, dialogs);
  67. if (condition.IsDiscryptied)
  68. {
  69. if (!string.IsNullOrEmpty(condition.Password))
  70. {
  71. if (pdfViewer.Document.UnlockWithPassword(condition.Password))
  72. {
  73. pdfViewer.Document.CheckOwnerPassword(condition.Password);
  74. }
  75. }
  76. string unicode;
  77. if (parameters.TryGetValue<string>(ParameterNames.Unicode, out unicode))
  78. {
  79. this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusNone, Unicode = unicode });
  80. }
  81. }
  82. currentLoadedPassword = pdfViewer.Document.Password;
  83. }
  84. if (pdfViewer != null && pdfViewer.Document != null)
  85. {
  86. CurrentFilePath = pdfViewer.Document.FilePath;
  87. List<string> list = new List<string>();
  88. list.Add(CurrentFilePath);
  89. AddFiles(list.ToArray());
  90. }
  91. string[] Paths;
  92. parameters.TryGetValue<string[]>(ParameterNames.FilePath, out Paths);
  93. if (Paths != null)
  94. {
  95. AddFiles(Paths);
  96. }
  97. }
  98. #endregion
  99. #region 定义与初始化
  100. public ObservableCollection<MergeObject> MergeObjectlist { get; set; }
  101. public DelegateCommand CancelCommand { get; set; }
  102. public DelegateCommand<object> PreviewCancelDownCommand { get; set; }
  103. public DelegateCommand MergeCommand { get; set; }
  104. public DelegateCommand<object> AddFilesCommand { get; set; }
  105. public DelegateCommand ClearCommand { get; set; }
  106. public DelegateCommand<object> SetPageSizeTypeCommand { get; set; }
  107. public IDialogService dialogs;
  108. private PageSizeType pageSizeType = PageSizeType.kDefault;
  109. private string inputWidth;
  110. public string InputWidth
  111. {
  112. get { return inputWidth; }
  113. set
  114. {
  115. SetProperty(ref inputWidth, value);
  116. }
  117. }
  118. private string inputHeight;
  119. public string InputHeight
  120. {
  121. get { return inputHeight; }
  122. set
  123. {
  124. SetProperty(ref inputHeight, value);
  125. }
  126. }
  127. public MergeDialogViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
  128. {
  129. this.eventAggregator = eventAggregator;
  130. dialogs = dialogService;
  131. MergeObjectlist = new ObservableCollection<MergeObject>();
  132. CancelCommand = new DelegateCommand(Cancel);
  133. PreviewCancelDownCommand = new DelegateCommand<object>(PreviewCancelDown);
  134. AddFilesCommand = new DelegateCommand<object>(ButtonAddFiles);
  135. MergeCommand = new DelegateCommand(Merge);
  136. ClearCommand = new DelegateCommand(Clear);
  137. SetPageSizeTypeCommand = new DelegateCommand<object>(SetPageSizeType);
  138. }
  139. #endregion
  140. #region 私有方法
  141. private void UpDataMergeObjectIndex()
  142. {
  143. for (int i = 0; i < MergeObjectlist.Count; i++)
  144. {
  145. MergeObjectlist[i].ItemIndex = i + 1;
  146. }
  147. }
  148. private void Cancel()
  149. {
  150. Clear();
  151. RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
  152. }
  153. /// <summary>
  154. /// 点击取消页面范围控件使失去焦点不生效
  155. /// </summary>
  156. private void PreviewCancelDown(object e)
  157. {
  158. var listView = e as ListView;
  159. if (listView != null)
  160. {
  161. if (listView.ItemsSource != null)
  162. {
  163. foreach (var item in listView.ItemsSource)
  164. {
  165. var pagerange= listView.ItemContainerGenerator.ContainerFromItem(item) as ListViewItem;
  166. if (pagerange != null)
  167. {
  168. var pagerangecombobox= CommonHelper.FindVisualChild<WritableComboBox>(pagerange);
  169. if(pagerangecombobox!=null)
  170. pagerangecombobox.IsloseFocus = false;
  171. }
  172. }
  173. }
  174. }
  175. }
  176. public void ButtonAddFiles(object data)
  177. {
  178. int index = Convert.ToInt32(data);
  179. switch (index)
  180. {
  181. case 0:
  182. //打开文件
  183. AddFiles(OpenFile());
  184. break;
  185. case 1:
  186. //打开文件夹
  187. AddFiles(OpenFileFolder());
  188. break;
  189. case 2:
  190. //打开当前文件
  191. List<string> list = new List<string>();
  192. for (int i = 0; i < App.OpenedFileList.Count; i++)
  193. {
  194. list.Add(App.OpenedFileList[i]);
  195. }
  196. AddFiles(list.ToArray());
  197. break;
  198. default:
  199. break;
  200. }
  201. }
  202. private string[] OpenFileFolder()
  203. {
  204. System.Windows.Forms.FolderBrowserDialog openFile = new System.Windows.Forms.FolderBrowserDialog();
  205. if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
  206. {
  207. return null;
  208. }
  209. DirectoryInfo tempfolder = new DirectoryInfo(openFile.SelectedPath);
  210. FileInfo[] fileInfos = tempfolder.GetFiles();
  211. List<string> list = new List<string>();
  212. foreach (FileInfo item in fileInfos)
  213. {
  214. list.Add(item.FullName);
  215. }
  216. DirectoryInfo[] directoryInfos = tempfolder.GetDirectories();
  217. foreach (DirectoryInfo fileInfo in directoryInfos)
  218. {
  219. FileInfo[] fileinfo = fileInfo.GetFiles();
  220. foreach (FileInfo item in fileinfo)
  221. {
  222. list.Add(item.FullName);
  223. }
  224. }
  225. return list.ToArray();
  226. }
  227. private string[] OpenFile()
  228. {
  229. OpenFileDialog openFile = new OpenFileDialog();
  230. openFile.Multiselect = true;
  231. openFile.Filter = Properties.Resources.imageex.ToLower() + "|*";
  232. if (openFile.ShowDialog() == false)
  233. {
  234. return null;
  235. }
  236. return openFile.FileNames;
  237. }
  238. private void Merge()
  239. {
  240. bool result = true;
  241. CPDFDocument SaveDoc = CPDFDocument.CreateDocument();
  242. for (int i = 0; i < MergeObjectlist.Count; i++)
  243. {
  244. List<int> listnum = new List<int>();
  245. if (MergeObjectlist[i].SetPageRange == null || MergeObjectlist[i].SetPageRange.Count == 0)
  246. {
  247. AlertsMessage alertsMessage = new AlertsMessage();
  248. alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
  249. return;
  250. }
  251. }
  252. for (int i = 0; i < MergeObjectlist.Count; i++)
  253. {
  254. if (MergeObjectlist[i].SetPageRange == null)
  255. {
  256. AlertsMessage alertsMessage = new AlertsMessage();
  257. alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
  258. }
  259. //图片
  260. if (Path.GetExtension(MergeObjectlist[i].FilePath).Trim().ToLower() != ".pdf")
  261. {
  262. if (Path.GetExtension(MergeObjectlist[i].FilePath).Trim().ToLower() == ".gif")
  263. {//GIF下面方法产生虚影改成与图片转PDF一致
  264. System.Drawing.Image img = System.Drawing.Image.FromFile(MergeObjectlist[i].FilePath);
  265. string tempFileName = Path.GetTempPath() + "pngtemp.jpg";
  266. if (!PictureConverter.SaveJpeg(MergeObjectlist[i].FilePath, tempFileName))
  267. {
  268. MessageBoxEx.Show("图片格式有问题");
  269. }
  270. // 之前插入位置为零点导致插入为第一页,改为尾插 2023/5/24
  271. result = SaveDoc.InsertPage(SaveDoc.PageCount, img.Width, img.Height, tempFileName);
  272. try { if (File.Exists(tempFileName)) File.Delete(tempFileName); }
  273. catch
  274. { }
  275. if (!result)
  276. {
  277. SaveDoc.Release();
  278. return;
  279. }
  280. continue;
  281. }
  282. else
  283. {
  284. BitmapSource frame = MergeObjectlist[i].DocThumbnail;
  285. byte[] imageData = new byte[frame.PixelWidth * frame.PixelHeight * 4];
  286. if (frame.Format != PixelFormats.Bgra32)
  287. {
  288. FormatConvertedBitmap covert = new FormatConvertedBitmap(frame, PixelFormats.Bgra32, frame.Palette, 0);
  289. covert.CopyPixels(imageData, frame.PixelWidth * 4, 0);
  290. }
  291. else
  292. {
  293. frame.CopyPixels(imageData, frame.PixelWidth * 4, 0);
  294. }
  295. frame.CopyPixels(imageData, frame.PixelWidth * 4, 0);
  296. // 之前插入位置为零点导致插入为第一页,改为尾插 2023/5/24
  297. result = SaveDoc.InsertPage(SaveDoc.PageCount, frame.PixelWidth, frame.PixelHeight, imageData, CPDFDocumentImageMode.CPDFDocumentImageModeScaleToFill);
  298. if (!result)
  299. {
  300. SaveDoc.Release();
  301. return;
  302. }
  303. continue;
  304. }
  305. }
  306. else
  307. {
  308. CPDFDocument tempDoc = CPDFDocument.InitWithFilePath(MergeObjectlist[i].FilePath);
  309. if (!string.IsNullOrEmpty(MergeObjectlist[i].Password))
  310. {
  311. tempDoc.UnlockWithPassword(MergeObjectlist[i].Password);
  312. }
  313. if (!string.IsNullOrEmpty(MergeObjectlist[i].SetPageRangeStr))
  314. {
  315. result = SaveDoc.ImportPages(tempDoc, MergeObjectlist[i].SetPageRangeStr);
  316. }
  317. else
  318. {
  319. //下拉框控件传出来的list是页面索引集合,
  320. //此处传给SDK的合并接口的是页码集合,因此需要将集合项遍历+1,只有合并接口是接收页码集合,其余接口是接受页面索引集合
  321. List<int> pageIndexs = new List<int>();
  322. for (int j = 0; j < MergeObjectlist[i].SetPageRange.Count; j++)
  323. {
  324. pageIndexs.Add(MergeObjectlist[i].SetPageRange[j] + 1);
  325. }
  326. result = SaveDoc.ImportPages(tempDoc, CommonHelper.GetPageParmFromList(pageIndexs));
  327. }
  328. if (!result)
  329. {
  330. SaveDoc.Release();
  331. tempDoc.Release();
  332. return;
  333. }
  334. tempDoc.Release();
  335. }
  336. }
  337. SaveFileDialog saveFileDialog = new SaveFileDialog();
  338. saveFileDialog.FileName = "Untitle";
  339. saveFileDialog.Filter = "PDF|*.pdf;";
  340. if (saveFileDialog.ShowDialog() == false)
  341. {
  342. return;
  343. }
  344. string path = saveFileDialog.FileName;
  345. System.Windows.Rect rect = new System.Windows.Rect();
  346. switch (pageSizeType)
  347. {
  348. case PageSizeType.kDefault:
  349. break;
  350. case PageSizeType.A4:
  351. rect.Width = CommonHelper.GetPageSizeFomrUnit(210);
  352. rect.Height = CommonHelper.GetPageSizeFomrUnit(297);
  353. break;
  354. case PageSizeType.A3:
  355. rect.Width = CommonHelper.GetPageSizeFomrUnit(297);
  356. rect.Height = CommonHelper.GetPageSizeFomrUnit(420);
  357. break;
  358. case PageSizeType.Letter:
  359. rect.Width = CommonHelper.GetPageSizeFomrUnit(216);
  360. rect.Height = CommonHelper.GetPageSizeFomrUnit(279);
  361. break;
  362. case PageSizeType.Legal:
  363. rect.Width = CommonHelper.GetPageSizeFomrUnit(216);
  364. rect.Height = CommonHelper.GetPageSizeFomrUnit(356);
  365. break;
  366. case PageSizeType.Customized:
  367. if (!string.IsNullOrEmpty(InputWidth) && !string.IsNullOrEmpty(InputHeight))
  368. {
  369. rect.Width = CommonHelper.GetPageSizeFomrUnit(Convert.ToInt32(InputWidth));
  370. rect.Height = CommonHelper.GetPageSizeFomrUnit(Convert.ToInt32(InputHeight));
  371. }
  372. else
  373. {
  374. rect.Width = CommonHelper.GetPageSizeFomrUnit(595);
  375. rect.Height = CommonHelper.GetPageSizeFomrUnit(841);
  376. }
  377. break;
  378. default:
  379. break;
  380. }
  381. if (rect.Width > 0 && rect.Height > 0)
  382. {
  383. //裁剪
  384. for (int i = 0; i < SaveDoc.PageCount; i++)
  385. {
  386. CPDFPage page = SaveDoc.PageAtIndex(i);
  387. page.CropPage(CPDFDisplayBox.MediaBox, rect);
  388. }
  389. }
  390. bool saveResult = SaveDoc.WriteToFilePath(path);
  391. SaveDoc.Release();
  392. CommonHelper.ShowFileBrowser(path);
  393. DialogParameters valuePairs = new DialogParameters();
  394. valuePairs.Add(ParameterNames.FilePath, path);
  395. RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
  396. }
  397. private void Clear()
  398. {
  399. MergeObjectlist.Clear();
  400. }
  401. private void SetPageSizeType(object button)
  402. {
  403. if (button is RadioButton)
  404. {
  405. pageSizeType = (PageSizeType)Convert.ToInt32((button as RadioButton).Tag);
  406. }
  407. }
  408. #endregion
  409. #region 公开方法
  410. public void DeleteItem(MergeObject merge)
  411. {
  412. MergeObjectlist.Remove(merge);
  413. UpDataMergeObjectIndex();
  414. }
  415. /// <summary>
  416. /// 拖拽插入
  417. /// </summary>
  418. public void MoveMerge(MergeObject targetNode, MergeObject soureNode)
  419. {
  420. int targetindex = MergeObjectlist.IndexOf(targetNode);
  421. MergeObjectlist.Remove(soureNode);
  422. if (targetNode.IsForward)
  423. {
  424. if (targetindex + 1 < MergeObjectlist.Count)
  425. {
  426. MergeObjectlist.Insert(targetindex + 1, soureNode);
  427. }
  428. else
  429. {
  430. MergeObjectlist.Add(soureNode);
  431. }
  432. }
  433. else
  434. {
  435. MergeObjectlist.Insert(targetindex, soureNode);
  436. }
  437. UpDataMergeObjectIndex();
  438. }
  439. public void AddFiles(string[] FilePath)
  440. {
  441. if (FilePath == null)
  442. {
  443. return;
  444. }
  445. bool showDialog = false;
  446. for (int i = 0; i < FilePath.Length; i++)
  447. {
  448. MergeObject mergeObject = new MergeObject();
  449. mergeObject.FilePath = FilePath[i];
  450. //通过路径判断文件是否已添加
  451. bool IsExists = false;
  452. for (int j = 0; j < MergeObjectlist.Count; j++)
  453. {
  454. if (MergeObjectlist[j].FilePath == mergeObject.FilePath)
  455. {
  456. IsExists = true;
  457. }
  458. }
  459. if (IsExists)
  460. {
  461. continue;
  462. }
  463. string FileType = Path.GetExtension(mergeObject.FilePath).Trim().ToLower();
  464. if (string.IsNullOrEmpty(FileType))
  465. {
  466. showDialog = true;
  467. //获取不到文件类型
  468. continue;
  469. }
  470. if (FileType != ".pdf")
  471. {
  472. string imagetype = "*" + FileType;
  473. string[] x = Properties.Resources.imageex.ToLower().Split(';');
  474. List<string> list = x.ToList();
  475. int imageindex = list.IndexOf(imagetype);
  476. if (imageindex < 0)
  477. {
  478. showDialog = true;
  479. //图片格式不支持
  480. continue;
  481. };
  482. mergeObject.DocName = Path.GetFileName(mergeObject.FilePath);
  483. mergeObject.DocPageCount = 1 + " " + App.MainPageLoader.GetString("Merge_ItemPages");
  484. mergeObject.SDKPageCount = 1;
  485. mergeObject.DocSize = CommonHelper.GetFileSize(mergeObject.FilePath);
  486. try
  487. {
  488. mergeObject.DocThumbnail = new BitmapImage(new Uri(mergeObject.FilePath));
  489. }
  490. catch (Exception)
  491. {
  492. showDialog = true;
  493. //解码错误
  494. continue;
  495. }
  496. }
  497. else
  498. {
  499. CPDFDocument doc = CPDFDocument.InitWithFilePath(mergeObject.FilePath);
  500. if (doc == null)
  501. {
  502. showDialog = true;
  503. //PDF打开失败
  504. continue;
  505. }
  506. ///Fix:
  507. ///情况分为:
  508. ///开启路径是当前路径:
  509. ///已解锁或本身就无密码->直接加入
  510. ///未解锁-> release
  511. ///
  512. /// 不是当前路径
  513. ///解锁或取消->
  514. ///
  515. if (CurrentFilePath == doc.FilePath)
  516. {
  517. if ((!(!doc.IsLocked && (SecurityHelper.CheckHaveAllPermissions(doc)))) &&
  518. (!(!string.IsNullOrEmpty(currentLoadedPassword) &&
  519. doc.UnlockWithPassword(currentLoadedPassword) &&
  520. (doc.CheckOwnerPassword(currentLoadedPassword) || SecurityHelper.CheckHaveAllPermissions(doc)))))
  521. {
  522. doc.Release();
  523. continue;
  524. }
  525. //添加的第一个文档有权限密码时,保存密码,避免合并时因没有密码导致合并失败
  526. //表现为在首页打开一个带权限的文档进入合并,点击合并按钮没有反应
  527. if (!string.IsNullOrEmpty(currentLoadedPassword))
  528. {
  529. mergeObject.Password = currentLoadedPassword;
  530. }
  531. }
  532. else
  533. {
  534. VerifyPasswordResult condition = SecurityHelper.VerifyPasswordByPasswordKind(doc, EnumPasswordKind.StatusPermissionsPassword, dialogs);
  535. if (condition.IsDiscryptied)
  536. {
  537. if (condition.Password != null)
  538. {
  539. mergeObject.Password = condition.Password;
  540. if (doc.UnlockWithPassword(condition.Password) && doc.CheckOwnerPassword(condition.Password))
  541. {
  542. }
  543. }
  544. }
  545. else
  546. {
  547. doc.Release();
  548. continue;
  549. }
  550. }
  551. mergeObject.DocName = doc.FileName;
  552. if (doc.PageCount > 1)
  553. {
  554. mergeObject.DocPageCount = doc.PageCount.ToString() + " " + App.MainPageLoader.GetString("Merge_ItemPages");
  555. mergeObject.IsEvenPageIsEnabled = true;
  556. }
  557. else
  558. {
  559. mergeObject.DocPageCount = doc.PageCount.ToString() + " " + App.MainPageLoader.GetString("Merge_ItemPage");
  560. mergeObject.IsEvenPageIsEnabled = false;
  561. }
  562. mergeObject.SDKPageCount = doc.PageCount;
  563. mergeObject.DocSize = CommonHelper.GetFileSize(mergeObject.FilePath);
  564. //获取第一页缩略图
  565. CPDFPage page = doc.PageAtIndex(0);
  566. Size size = doc.GetPageSize(0);
  567. byte[] bmpData = new byte[(int)(size.Width * size.Height * 4)];
  568. WriteableBitmap WirteBitmap = new WriteableBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Bgra32, null);
  569. page.RenderPageBitmap(0, 0, (int)size.Width, (int)size.Height, 0xFFFFFFFF, bmpData, 1);
  570. WirteBitmap.WritePixels(new Int32Rect(0, 0, (int)size.Width, (int)size.Height), bmpData, WirteBitmap.BackBufferStride, 0);
  571. WirteBitmap.Freeze();
  572. mergeObject.DocThumbnail = WirteBitmap;
  573. doc.Release();
  574. }
  575. MergeObjectlist.Add(mergeObject);
  576. UpDataMergeObjectIndex();
  577. }
  578. if (showDialog)
  579. {
  580. AlertsMessage alertsMessage = new AlertsMessage();
  581. alertsMessage.ShowDialog("", App.MainPageLoader.GetString("ErrorFile_Warning"), App.ServiceLoader.GetString("Text_ok"));
  582. if (alertsMessage.result == ContentResult.Ok)
  583. {
  584. }
  585. }
  586. }
  587. #endregion
  588. }
  589. }