Browse Source

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

ZhouJieSheng 1 year ago
parent
commit
9026e88a56

+ 5 - 0
PDF Office/App.xaml.cs

@@ -136,6 +136,11 @@ namespace PDF_Master
 
         public static bool IsBookMode = false;
 
+        /// <summary>
+        /// 是否使用过高级功能
+        /// </summary>
+        public static bool IsUsedVIP = false;
+
         /// <summary>
         /// 是否已经登陆
         /// </summary>

+ 31 - 16
PDF Office/Helper/ServiceHelper.cs

@@ -253,6 +253,7 @@ namespace PDF_Master.Helper
         /// <param name="post">是否请求服务器</param>
         public static bool IAPBeforeFunction(bool post = false)
         {
+            App.IsUsedVIP= true;
             if (!post)
             {
                 //判断本地有没有token,没有显示登录,有再判断登录状态
@@ -345,22 +346,34 @@ namespace PDF_Master.Helper
                         App.IsLogin = true;
                         Settings.Default.UserDate.Email= jobject["email"].ToObject<string>().ToLower();
                         Settings.Default.UserDate.id= jobject["id"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.subscribeid = jobject["subscriptionInfoList"][0]["id"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.subscribeuserid = jobject["subscriptionInfoList"][0]["userId"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.subscribeplatform = jobject["subscriptionInfoList"][0]["platform"].ToObject<int>();
-                        Settings.Default.UserDate.subscribestatus = jobject["subscriptionInfoList"][0]["status"].ToObject<int>();
-                        if(Settings.Default.UserDate.subscribestatus>0)
+                        JArray subscriptionInfoList = (JArray)jobject["subscriptionInfoList"];
+
+                        foreach (JToken info in subscriptionInfoList)
                         {
-                            Settings.Default.UserDate.subscribeendDate = jobject["subscriptionInfoList"][0]["endDate"].ToObject<string>().ToLower();
+                            if ((int)info["platform"] == 2)
+                            {
+                                Settings.Default.UserDate.subscribeid = (string)info["id"];
+                                Settings.Default.UserDate.subscribeuserid = (string)info["userId"];
+                                Settings.Default.UserDate.subscribeplatform = (int)info["platform"];
+                                Settings.Default.UserDate.subscribestatus = (int)info["status"];
+                                if (Settings.Default.UserDate.subscribestatus > 0)
+                                {
+                                    Settings.Default.UserDate.subscribeendDate = (string)info["endDate"];
+                                    Settings.Default.UserDate.subscribepayType = (int)info["payType"];
+                                }
+                              
+
+                            }
+                        }
+                        //此处为主页UPgread按钮的Visible
+                        if (Settings.Default.UserDate.subscribestatus == 1)
+                        {
+                            App.mainWindowViewModel.UpgradeVis = Visibility.Collapsed;
+                        }
+                        else
+                        {
+                            App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
                         }
-
-                     
-                        Settings.Default.UserDate.subscribepayType = jobject["subscriptionInfoList"][0]["payType"].ToObject<int>();
-
-
-                        //Settings.Default.UserDate.subscriberType = jobject["subscriberType"].ToObject<string>().ToLower();
-
-
                         #region 试用策略
                         //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
                         //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
@@ -413,11 +426,11 @@ namespace PDF_Master.Helper
                 //}
                 return "300";
             }
+
            
-               
 
 
-            
+
         }
 
         /// <summary>
@@ -769,6 +782,7 @@ namespace PDF_Master.Helper
                     App.IsLogin = false;
                     Settings.Default.UserDate.subscribestatus = -1;
                     Settings.Default.UserDate.subscribepayType = 0;
+                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
                     if (response != null)
                     {
                         response.Close();
@@ -819,6 +833,7 @@ namespace PDF_Master.Helper
                     App.IsLogin = false;
                     Settings.Default.UserDate.subscribestatus = -1;
                     Settings.Default.UserDate.subscribepayType = 0;
+                    App.mainWindowViewModel.UpgradeVis = Visibility.Visible;
                     if (response != null)
                     {
                         response.Close();

+ 4 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -90,6 +90,7 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
         {
             await System.Threading.Tasks.Task.Run(() =>
             {
+                //当进度条消失时,结束进程(由于取消时OnOpened没有完全结束,等待OnOpened结束时就会结束)
                 for (int i = 1; App.mainWindowViewModel.IsProcessVisible != System.Windows.Visibility.Collapsed; i++)
                 {
                     try
@@ -105,9 +106,12 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
 
         private void ConverterClear()
         {
+            //取消转档
             ConverterHelper.Clear(ConvertType);
+            //取消转档的进度条,防止转档还没结束,导致取消后程序崩溃,添加一个取消进度条
             App.mainWindowViewModel.ProcessCloseBtnVisible = System.Windows.Visibility.Collapsed;
             App.mainWindowViewModel.ProgressTitle = "Canceling";
+            //判断取消进度条消失逻辑
             TaskMethod();
             //App.mainWindowViewModel.ProgressTitle = "";
             //App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;

+ 1 - 0
PDF Office/PDF Master.csproj

@@ -2368,6 +2368,7 @@
     <Resource Include="Resources\Service\Warermark.png" />
     <Resource Include="Resources\Service\NOai.png" />
     <Resource Include="Resources\Service\Noconvert.png" />
+    <Resource Include="Resources\Service\Upgrade.png" />
     <Content Include="source\models\OCR.model">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

BIN
PDF Office/Resources/Service/Upgrade.png


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

@@ -318,7 +318,7 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
             if(Settings.Default.UserDate.subscribestatus == 1)
             {
                 AlertsMessage alertsMessage = new AlertsMessage();
-                alertsMessage.ShowDialog("注不了销 ", "无法注销,需要订阅期结束后再申请注销 ", App.ServiceLoader.GetString("Text_yes"), App.ServiceLoader.GetString("Text_no"), IconType.Tip);
+                alertsMessage.ShowDialog("注不了销 ", "无法注销,需要订阅期结束后再申请注销 ", App.ServiceLoader.GetString("Text_yes"),IconType.Tip);
             }
             else
             {

+ 22 - 1
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -24,6 +24,7 @@ using PDF_Master.Properties;
 using PDF_Master.Helper;
 using PDFSettings;
 using PDF_Master.ViewModels.Dialog.ServiceDialog;
+using System.Diagnostics;
 
 namespace PDF_Master.ViewModels
 {
@@ -140,7 +141,19 @@ namespace PDF_Master.ViewModels
             }
         }
 
+        /// <summary>
+        /// UpgradeVis按钮只在订阅期中显示
+        /// </summary>
+        private Visibility _UpgradeVis = Visibility.Visible;
 
+        public Visibility UpgradeVis
+        {
+            get { return _UpgradeVis; }
+            set
+            {
+                SetProperty(ref _UpgradeVis, value);
+            }
+        }
         /// <summary>
         ///提示登录高级功能
         /// </summary>
@@ -156,7 +169,6 @@ namespace PDF_Master.ViewModels
         }
 
 
-
         private Visibility _RegisterVis = Visibility.Collapsed;
 
         public Visibility RegisterVis
@@ -265,6 +277,8 @@ namespace PDF_Master.ViewModels
         public DelegateCommand OpenLoginCommand { get; set; }
         public DelegateCommand OpenUserCommand { get; set; }
         public DelegateCommand LoadCommand { get; set; }
+        public DelegateCommand UpgradelinkCommand { get; set; }
+       
 
         public IRegionManager region;
 
@@ -298,6 +312,7 @@ namespace PDF_Master.ViewModels
             OpenRegisterCommand = new DelegateCommand(OpenRegister);
             OpenLoginCommand = new DelegateCommand(OpenLogin);
             OpenUserCommand = new DelegateCommand(OpenUser);
+            UpgradelinkCommand= new DelegateCommand(Upgradelink);
             CloseAllTabCommand = new DelegateCommand(() =>
             {
                 if (closeAllTabItem())
@@ -391,6 +406,12 @@ namespace PDF_Master.ViewModels
             InitString();
         }
 
+       
+
+            private void Upgradelink()
+        {
+            Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/master/checkout?email="+Settings.Default.UserDate.Email));
+        }
         //显示新手引导弹窗
         private bool ShowGuidDialog()
         {

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

@@ -2721,7 +2721,7 @@ namespace PDF_Master.ViewModels
             try
             {
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
-                if (!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)
+                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)&&App.IsUsedVIP==true)
                 {
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.ViewContentViewModel, this);
@@ -2990,7 +2990,7 @@ namespace PDF_Master.ViewModels
             {
                 bool flg = false;
                 //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
-                if (!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1)
+                if ((!App.IsLogin || Settings.Default.UserDate.subscribestatus != 1) && App.IsUsedVIP == true)
                 {
                     DialogParameters value = new DialogParameters();
                     value.Add(ParameterNames.ViewContentViewModel, this);

+ 7 - 0
PDF Office/Views/MainWindow.xaml

@@ -277,7 +277,14 @@
             Orientation="Horizontal"
             WindowChrome.IsHitTestVisibleInChrome="True">
 
+                <Border Width="87" Height="24"  Visibility="{Binding UpgradeVis}">
+                    <Border.InputBindings>
+                        <MouseBinding MouseAction="LeftClick" Command="{Binding  UpgradelinkCommand}" />
+                    </Border.InputBindings>
+                    <Image Source="pack://application:,,,/PDF Master;component/Resources/Service/Upgrade.png" />
+                    </Border>
 
+               
                 <Button
                 x:Name="Btn_Register"
                 Width="40"

+ 2 - 0
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -191,6 +191,8 @@ namespace PDF_Master.Views.PageEdit
                             if (e.PageRange[i] - 1 < ListPageEdit.Items.Count)
                             {
                                 ListPageEdit.SelectedItems.Add(ListPageEdit.Items[e.PageRange[i] - 1]);
+                                //页码 下拉框 ,选择全选页面、奇数、偶数等情况,偶现IsMultiSelected=false,这里先强制设置一下
+                                viewModel.IsMultiSelected = true;
                             }
                             ListPageEdit.ScrollIntoView(ListPageEdit.SelectedItem);
                         }