Browse Source

比较表-方法移动到帮助类,轻会员-刷新状态按钮逻辑修改

lvle 1 year ago
parent
commit
dee3127f20

+ 48 - 0
PDF Office/Helper/ServiceHelper.cs

@@ -1,6 +1,8 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using PDF_Master.Model;
 using PDF_Master.Properties;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -11,6 +13,7 @@ using System.Runtime.InteropServices;
 using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 
 namespace PDF_Master.Helper
 {
@@ -244,6 +247,51 @@ namespace PDF_Master.Helper
             return DeviceBuilder.ToString();
         }
 
+        /// <summary>
+        /// 高级功能前弹出比较表
+        /// </summary>
+        /// <param name="post">是否请求服务器</param>
+        public static bool IAPBeforeFunction(bool post = false)
+        {
+            if (post)
+            {
+                //判断本地有没有token,没有显示登录,有再判断登录状态
+                if (Settings.Default.AppProperties.LoginToken != "")
+                {
+                    if (ServiceHelper.GetUser() == "401")
+                    {
+                        App.mainWindowViewModel.UserVis = Visibility.Collapsed;
+                        App.mainWindowViewModel.LoginVis = Visibility.Visible;
+                        App.mainWindowViewModel.OphVis = Visibility.Visible;
+
+                        if (Settings.Default.UserDate.IsLoginoff == false)
+                        {
+                            App.mainWindowViewModel.OpenLoginoff();
+                            Settings.Default.UserDate.IsLoginoff = true;
+                            Settings.Default.Save();
+                        }
+                    }
+                }
+                else
+                {
+                    App.mainWindowViewModel.UserVis = Visibility.Collapsed;
+                    App.mainWindowViewModel.LoginVis = Visibility.Visible;
+                    App.mainWindowViewModel.OphVis = Visibility.Visible;
+                }
+            }
+
+            //付费锁
+            //删掉 Settings.Default.UserDate.isInFreeUseTime == false,没有试用期了;
+            if (!App.IsLogin)
+            {
+                App.mainWindowViewModel.dialogs.ShowDialog(DialogNames.IAPCompareDialog);
+                return false;
+            }
+            return true;
+        }
+
+
+
 
         //超时同步为20秒
         /// <summary>

+ 1 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/IAPCompareDialogViewModel.cs

@@ -174,7 +174,7 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
             }
 
 
-            if (Settings.Default.UserDate.subscribestatus == 1)
+            if (Settings.Default.UserDate.subscribestatus == 1&&App.IsLogin==true)
             {
                 Close();
             }

+ 1 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/SubscriptionDialogViewModel.cs

@@ -204,7 +204,7 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
             }
 
 
-            if (Settings.Default.UserDate.subscribestatus == 1)
+            if (Settings.Default.UserDate.subscribestatus == 1&&App.IsLogin == true)
             {
                 Close();
             }

+ 1 - 1
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -446,7 +446,7 @@ namespace PDF_Master.ViewModels.FillAndSign
             bool isTemplateAnnot = false;
             bool isSnapshotEdit = false;
             AnnotHandlerEventArgs annotArgs = null;
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }

+ 4 - 4
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -1491,7 +1491,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         private void copy()
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -1541,7 +1541,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         private async void paste(int Index = -1)
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -1801,7 +1801,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         private void DoRemoveSelectedPages(List<int> pageList = null, bool isFromUndoRedo = false)
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -2475,7 +2475,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// <param name="rightRotate"></param>
         private async void RotateSelectedPages(bool rightRotate = true, List<int> pageitems = null, bool isFromUndoRedo = false)
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }

+ 3 - 3
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -333,7 +333,7 @@ namespace PDF_Master.ViewModels.Tools
                 case "Stamp"://图章
                              //付费锁
                              //判断本地有没有token,没有显示登录,有再判断登录状态
-                    if (!ViewContentViewModel.IAPBeforeFunction())
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         StrAnnotToolChecked = "";
                         return;
@@ -348,7 +348,7 @@ namespace PDF_Master.ViewModels.Tools
 
                 case "Signature"://签名
                                  //判断本地有没有token,没有显示登录,有再判断登录状态
-                    if (!ViewContentViewModel.IAPBeforeFunction())
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         StrAnnotToolChecked = "";
                         return;
@@ -360,7 +360,7 @@ namespace PDF_Master.ViewModels.Tools
                 case "Link"://链接
                             //付费锁
                             //判断本地有没有token,没有显示登录,有再判断登录状态
-                            //if (!viewContentViewModel.IAPBeforeFunction())
+                            //if (!ServiceHelper.IAPBeforeFunction())
                             //{
                             //    StrAnnotToolChecked = "";
                             //    return;

+ 2 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -491,7 +491,7 @@ namespace PDF_Master.ViewModels.Tools
                 if (str == AddAnnotType.AnnotLink.ToString())
                 {
                     //添加付费拦截锁
-                    if (!ViewContentViewModel.IAPBeforeFunction())
+                    if (!ServiceHelper.IAPBeforeFunction())
                     {
                         return;
                     }
@@ -669,7 +669,7 @@ namespace PDF_Master.ViewModels.Tools
 
                     case "Link"://链接
                         //添加付费拦截锁
-                        if (!ViewContentViewModel.IAPBeforeFunction())
+                        if (!ServiceHelper.IAPBeforeFunction())
                         {
                             return;
                         }

+ 1 - 1
PDF Office/ViewModels/Tools/ConverterBarContentViewModel.cs

@@ -66,7 +66,7 @@ namespace PDF_Master.ViewModels.Tools
 
         private async void toconverter(object sender)
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }

+ 6 - 6
PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs

@@ -190,7 +190,7 @@ namespace PDF_Master.ViewModels.Tools
 
         private async void OpenCompressDialog()
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -248,7 +248,7 @@ namespace PDF_Master.ViewModels.Tools
         //}
         private async void MergeDialog()
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -265,7 +265,7 @@ namespace PDF_Master.ViewModels.Tools
 
         private void OpenSetPasswordDialog()
         {
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -309,7 +309,7 @@ namespace PDF_Master.ViewModels.Tools
             }
             else
             {
-                if (!viewContentViewModel.IAPBeforeFunction())
+                if (ServiceHelper.IAPBeforeFunction())
                 {
                     return;
                 }
@@ -358,7 +358,7 @@ namespace PDF_Master.ViewModels.Tools
         private void WaitCropCurrentPageWM()
         {
 
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }
@@ -393,7 +393,7 @@ namespace PDF_Master.ViewModels.Tools
         private void WaitCropAllPagesWM()
         {
 
-            if (!viewContentViewModel.IAPBeforeFunction())
+            if (!ServiceHelper.IAPBeforeFunction())
             {
                 return;
             }

+ 1 - 1
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -857,7 +857,7 @@ namespace PDF_Master.Views.PageEdit
                 Trace.WriteLine("Grid_DragOver 文件拖出App");
 
                 //将付费锁逻辑提前,避免因弹窗显示后导致虚影无法消失问题
-                if (!viewModel.viewContentViewModel.IAPBeforeFunction())
+                if (!ServiceHelper.IAPBeforeFunction())
                 {
                     return;
                 }