Browse Source

打印 - 自定义传入 安全 - 崩溃问题

liuaoran 2 years ago
parent
commit
87c67ccc26

+ 8 - 17
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -47,6 +47,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
 
 
         public PrintSettingsInfo PrintSettingsInfo = new PrintSettingsInfo();
+        List<int> PageList = new List<int>();
+
 
         #region 常用字符串
         public string Title => "";
@@ -902,24 +904,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                     isCurrentPage = false;
                 }
 
-                //if (parameters.TryGetValue<List<int>>(ParameterNames.PageList, out PageList))
-                //{
-                //    PageListString = CommonHelper.GetPageParmFromList(PageList);
-                //    if (!string.IsNullOrEmpty(PageListString))
-                //    {
-                //        PrintSettingsInfo.PageRangeList = PageList;
-                //    }
-                //}
-                List<int> PageList = new List<int>();
-
-                PageRangeSelectIndex = 4;
-                PageList.Clear();
-                PageList.Add(1);
-                PageList.Add(2);
-                PageListString = CommonHelper.GetPageParmFromList(PageList);
-                if (!string.IsNullOrEmpty(PageListString))
+                if (parameters.TryGetValue<List<int>>(ParameterNames.PageList, out PageList))
                 {
-                    PrintSettingsInfo.PageRangeList = PageList;
+                    PageListString = CommonHelper.GetPageParmFromList(PageList);
+                    if (!string.IsNullOrEmpty(PageListString))
+                    {
+                        PrintSettingsInfo.PageRangeList = PageList;
+                    }
                 }
 
                 System.Windows.Size pageSize = PDFViewer.Document.GetPageSize(0);

+ 7 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -1597,8 +1597,14 @@ namespace PDF_Office.ViewModels
                         {
                             PDFViewer.Document.UnlockWithPassword(openPassword);
                         }
+                        try
+                        {
+                            PDFViewer.Load();
+                        }
+                        catch
+                        {
 
-                        PDFViewer.Load();
+                        }
                         PDFViewer.UndoManager.CanSave = false;
                         SecurityInfo.IsPasswordChanged = false;
                         return true;