Browse Source

安全 - 一些tip隐藏的场景

liuaoran 2 years ago
parent
commit
772cfd1765

+ 5 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -1033,6 +1033,11 @@ namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                         PDFViewer.Document.CheckOwnerPassword(result.Password);
                     }
                 }
+                string appUnicode = string.Empty;
+                if (parameters.TryGetValue<string>(ParameterNames.Unicode, out appUnicode))
+                {
+                    this.printEvent.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusNone , Unicode= appUnicode });
+                }
             }
 
             if (!result.IsDiscryptied)

+ 12 - 7
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -3,11 +3,13 @@ using ComPDFKit.PDFPage;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
 using PDF_Master.CustomControl;
+using PDF_Master.EventAggregators;
 using PDF_Master.Helper;
 using PDF_Master.Model;
 using PDF_Master.Model.Dialog.ToolsDialogs;
 using PDF_Master.Views.Dialog;
 using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
@@ -33,7 +35,7 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         //解锁失败再另行提权
         private string CurrentFilePath = string.Empty;
         private string currentLoadedPassword = string.Empty;
-
+        private IEventAggregator eventAggregator;
         enum PageSizeType
         {
             kDefault = 0,
@@ -75,6 +77,11 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
                             pdfViewer.Document.CheckOwnerPassword(condition.Password);
                         }
                     }
+                    string unicode;
+                    if (parameters.TryGetValue<string>(ParameterNames.Unicode, out unicode))
+                    {
+                        this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusNone, Unicode = unicode });
+                    } 
                 }
                 currentLoadedPassword = pdfViewer.Document.Password;
             }
@@ -144,8 +151,9 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
         }
 
 
-        public MergeDialogViewModel(IDialogService dialogService)
+        public MergeDialogViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
         {
+            this.eventAggregator = eventAggregator;
             dialogs = dialogService;
             MergeObjectlist = new ObservableCollection<MergeObject>();
             CancelCommand = new DelegateCommand(Cancel);
@@ -483,11 +491,8 @@ namespace PDF_Master.ViewModels.Dialog.ToolsDialogs
 
                     ///Fix:当前情况下,即带着当前文档进入合并,此时可以先行鉴权
                     ///鉴权完毕后如果有提权行为,还要给原文档提权
-                    if (CurrentFilePath == doc.FilePath && !string.IsNullOrEmpty(currentLoadedPassword) && doc.UnlockWithPassword(currentLoadedPassword)&&doc.CheckOwnerPassword(currentLoadedPassword))
-                    {
-                        
-                    }
-                    else
+                    if (!(CurrentFilePath == doc.FilePath && !string.IsNullOrEmpty(currentLoadedPassword) && doc.UnlockWithPassword(currentLoadedPassword)&&doc.CheckOwnerPassword(currentLoadedPassword)))
+                    
                     {
                         VerifyPasswordResult condition = SecurityHelper.VerifyPasswordByPasswordKind(doc, EnumPasswordKind.StatusPermissionsPassword, dialogs);
                         if (condition.IsDiscryptied)

+ 4 - 0
PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs

@@ -198,6 +198,7 @@ namespace PDF_Master.ViewModels.Tools
             DialogParameters value = new DialogParameters();
             value.Add(ParameterNames.PDFViewer, PDFViewer);
             value.Add(ParameterNames.FilePath, PDFViewer.Document.FilePath);
+            value.Add(ParameterNames.Unicode, unicode);
             dialogs.ShowDialog(DialogNames.MergeDialog, value, e => { });
         }
 
@@ -210,6 +211,7 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     PDFViewer.Document.CheckOwnerPassword(result.Password);
                 }
+                this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusNone, Unicode = unicode });
 
                 DialogParameters value = new DialogParameters();
                 value.Add(ParameterNames.PDFViewer, this.PDFViewer);
@@ -248,6 +250,8 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         PDFViewer.Document.CheckOwnerPassword(result.Password);
                     }
+                    this.eventAggregator.GetEvent<ShowTipEvent>().Publish(new ShowTipEventArgs() { enumTipKind = EnumTipKind.StatusNone, Unicode = unicode });
+
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.PDFDocument, PDFViewer.Document);
                     value.Add(ParameterNames.ViewContentViewModel, this.viewContentViewModel);

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

@@ -1106,7 +1106,7 @@ namespace PDF_Master.ViewModels
                         PDFViewer.Document.Release();
                         PDFViewer.InitDocument(filePath);
                         PDFViewer.Document.UnlockWithPassword(result.Password);
-                    }
+                    } 
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.PDFDocument, PDFViewer.Document);
                     dialogs.ShowDialog(DialogNames.DeleteSafetySettingsDialog, value, e => { });
@@ -1331,6 +1331,7 @@ namespace PDF_Master.ViewModels
             printValue.Add(ParameterNames.PDFViewer, PDFViewer);
             printValue.Add(ParameterNames.FilePath, PDFViewer.Document.FileName);
             printValue.Add(ParameterNames.PrintCurrentPage, PDFViewer.CurrentIndex);
+            printValue.Add(ParameterNames.Unicode, unicode);
             dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printValue, e => { });
         }