Ver Fonte

轻会员-水印保存bug修复

lvle há 1 ano atrás
pai
commit
16edbb11fa

+ 7 - 4
PDF Office/ViewModels/Dialog/ServiceDialog/SubscriptionDialogViewModel.cs

@@ -203,18 +203,21 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
         /// </summary>
         private void WarermarkSaving()
         {
+            
             String IsFormSave = "FormSave";
            
             if(open!=null)
             {
-                Close();
+                RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
             }
             else
             {
-                viewContentViewModel.saveAsFile(null, IsFormSave);
-                Close();
+               if( viewContentViewModel.saveAsFile(null, IsFormSave)==false)
+                {
+                    RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
+                }
+              else  RequestClose?.Invoke(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK));
             }
-            
         }
 
         /// <summary>

+ 20 - 6
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -2757,6 +2757,8 @@ namespace PDF_Master.ViewModels
         {
             try
             {
+                //是否取消了水印保存步骤
+                bool flg = false;
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
                 if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) &&   (App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel).IsUsedVIP== true)
                 {
@@ -2764,11 +2766,16 @@ namespace PDF_Master.ViewModels
                     value.Add(ParameterNames.ViewContentViewModel, this);
                     dialogs.ShowDialog(DialogNames.SubscriptionDialog, value, dialogResult =>
                     {
-
+                        if (dialogResult.Result == ButtonResult.OK)
+                        {
+                             flg = true;
+                        }
+                        else
+                        {
+                            flg= false;
+                        }
                     });
-
-
-                    return false;
+                        return flg;
 
                 }
 
@@ -3019,6 +3026,7 @@ namespace PDF_Master.ViewModels
         /// </summary>
         public bool saveAsFile(Action RedactionAction = null, String IsFormSave=null)
         {
+            //是否来自savefile方法
             if(IsFormSave=="FormSave")
             {
                 var dlg = new Microsoft.Win32.SaveFileDialog();
@@ -3026,6 +3034,7 @@ namespace PDF_Master.ViewModels
                 dlg.FileName = PDFViewer.Document.FileName;
                 if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.FileName))
                 {
+                  
                     bool result = false;
                     if (RedactionAction != null)
                     {
@@ -3135,17 +3144,21 @@ namespace PDF_Master.ViewModels
                     value.Add(ParameterNames.Open, "saveAs");
                     dialogs.ShowDialog(DialogNames.SubscriptionDialog, value, dialogResult =>
                     {
-                        if (dialogResult.Result == ButtonResult.Cancel)
+                        if (dialogResult.Result == ButtonResult.OK)
                         {
                             flg = true;
                         }
+                        else
+                        {
+                            flg = false;
+                        }
                     });
 
                     if (flg == false)
                     {
                         return false;
                     }
-                }
+                  }
                 var dlg = new Microsoft.Win32.SaveFileDialog();
                 dlg.Filter = Properties.Resources.OpenDialogFilter;
                 dlg.FileName = PDFViewer.Document.FileName;
@@ -3183,6 +3196,7 @@ namespace PDF_Master.ViewModels
                         }
 
                         PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
+                        //是否需要加水印
                         if(flg==true)
                         {
                             Uri resourceUri = new Uri("pack://application:,,,/PDF Master;component/Resources/Service/Warermark.png");