浏览代码

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

OYXH\oyxh 1 年之前
父节点
当前提交
1f220a463b

二进制
PDF Office/ComPDFKit.Viewer.dll


+ 140 - 9
PDF Office/Helper/ChatGTPAIHelper.cs

@@ -1,4 +1,6 @@
-using Newtonsoft.Json;
+using ComPDFKit_Conversion.Options;
+using DryIoc;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using PDF_Master.Properties;
 using System;
@@ -12,6 +14,7 @@ using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using static Dropbox.Api.Files.SearchMatchType;
+using static Dropbox.Api.TeamLog.EventCategory;
 
 namespace PDF_Master.Helper
 {
@@ -67,9 +70,9 @@ namespace PDF_Master.Helper
         /// <param name="content"></param>
         /// <param name="language">1=中文 2=英文 3=法语 4=汉语</param>
         /// <returns></returns>
-        public async static Task<string> fileKeyTranslate(string content,string filename)
+        public async static Task<string> fileKeyTranslate(string content, string filename)
         {
-            
+
             HttpWebResponse response = null;
             ServicePointManager.DefaultConnectionLimit = 200;
             HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Uri_fileKeytranslate);
@@ -97,11 +100,11 @@ namespace PDF_Master.Helper
             // 将FormData写入请求体
             using (var requestStream = request.GetRequestStream())
             {
-              await formData.CopyToAsync(requestStream);
+                await formData.CopyToAsync(requestStream);
             }
             try
             {
-                
+
                 // 获取HTTP响应
                 HttpWebResponse response2 = (HttpWebResponse)request.GetResponse();
                 using (StreamReader reader = new StreamReader(response2.GetResponseStream()))
@@ -244,9 +247,9 @@ namespace PDF_Master.Helper
                         }
                         client.DownloadProgressChanged += (sender, e) =>
                         {
-                            
+
                         };
-                        client.DownloadFile(translate, folderPath+"\\" +file.Name);
+                        client.DownloadFile(translate, folderPath + "\\" + file.Name);
                     }
                     return "200";
                 }
@@ -266,7 +269,7 @@ namespace PDF_Master.Helper
         /// <param name="fromlanguage">文本语言</param>
         /// <param name="tolanguage">需要翻译的语言</param>
         /// <returns></returns>
-        public static String textTranslate(string content, string fromlanguage, string tolanguage,ref string translate)
+        public static String textTranslate(string content, string fromlanguage, string tolanguage, ref string translate)
         {
 
             HttpWebResponse response = null;
@@ -352,7 +355,8 @@ namespace PDF_Master.Helper
             {
                 namevalue["user_id"] = Settings.Default.UserDate.id;
             }
-            else {
+            else
+            {
                 namevalue["user_id"] = "3";
             }
             namevalue["content"] = content;
@@ -456,6 +460,133 @@ namespace PDF_Master.Helper
             }
             return repsonseData;
         }
+
+        public static List<string> FromlanguageFamily { set; get; } = new List<string>();
+        public static List<string> SetFromlanguageOrigin()
+        {
+            FromlanguageFamily.Clear();
+            FromlanguageFamily.Add("Automatic Identification");
+            FromlanguageFamily.Add("English");
+            FromlanguageFamily.Add("Simplified Chinese");
+            FromlanguageFamily.Add("Traditional Chinese");
+            FromlanguageFamily.Add("Japanese");
+            FromlanguageFamily.Add("Korean");
+            FromlanguageFamily.Add("French");
+            FromlanguageFamily.Add("Spanish");
+            FromlanguageFamily.Add("Italian");
+            FromlanguageFamily.Add("German");
+            FromlanguageFamily.Add("Portuguese");
+            FromlanguageFamily.Add("Russian");
+            FromlanguageFamily.Add("Vietnamese");
+            FromlanguageFamily.Add("Thai");
+            FromlanguageFamily.Add("Arabic");
+            FromlanguageFamily.Add("Greek");
+            FromlanguageFamily.Add("Bulgarian");
+            FromlanguageFamily.Add("Finnish");
+            FromlanguageFamily.Add("Slovene");
+            FromlanguageFamily.Add("Dutch");
+            FromlanguageFamily.Add("Czech");
+            FromlanguageFamily.Add("Swedish");
+            FromlanguageFamily.Add("Polish");
+            FromlanguageFamily.Add("Danish");
+            FromlanguageFamily.Add("Romanian");
+            FromlanguageFamily.Add("Hungarian");
+
+            return FromlanguageFamily;
+        }
+
+        public static List<string> TolanguageFamily { set; get; } = new List<string>();
+        public static List<string> SetTolanguageOrigin()
+        {
+            TolanguageFamily.Clear();
+            TolanguageFamily.Add("English");
+            TolanguageFamily.Add("Simplified Chinese");
+            TolanguageFamily.Add("Traditional Chinese");
+            TolanguageFamily.Add("Japanese");
+            TolanguageFamily.Add("Korean");
+            TolanguageFamily.Add("French");
+            TolanguageFamily.Add("Spanish");
+            TolanguageFamily.Add("Italian");
+            TolanguageFamily.Add("German");
+            TolanguageFamily.Add("Portuguese");
+            TolanguageFamily.Add("Russian");
+            TolanguageFamily.Add("Vietnamese");
+            TolanguageFamily.Add("Thai");
+            TolanguageFamily.Add("Arabic");
+            TolanguageFamily.Add("Greek");
+            TolanguageFamily.Add("Bulgarian");
+            TolanguageFamily.Add("Finnish");
+            TolanguageFamily.Add("Slovene");
+            TolanguageFamily.Add("Dutch");
+            TolanguageFamily.Add("Czech");
+            TolanguageFamily.Add("Swedish");
+            TolanguageFamily.Add("Polish");
+            TolanguageFamily.Add("Danish");
+            TolanguageFamily.Add("Romanian");
+            TolanguageFamily.Add("Hungarian");
+            return TolanguageFamily;
+        }
+
+        public static string UpdateLanguagebType(int index)
+        {
+            switch (index)
+            {
+                case 0:
+                    return "auto";
+                case 1:
+                    return "en";
+                case 2:
+                    return "zh";
+                case 3:
+                    return "cht";
+                case 4:
+                    return "jp";
+                case 5:
+                    return "kor";
+                case 6:
+                    return "fra";
+                case 7:
+                    return "spa";
+                case 8:
+                    return "it";
+                case 9:
+                    return "de";
+                case 10:
+                    return "pt";
+                case 11:
+                    return "ru";
+                case 12:
+                    return "vie";
+                case 13:
+                    return "th";
+                case 14:
+                    return "ara";
+                case 15:
+                    return "el";
+                case 16:
+                    return "bul";
+                case 17:
+                    return "fin";
+                case 18:
+                    return "slo";
+                case 19:
+                    return "nl";
+                case 20:
+                    return "cs";
+                case 21:
+                    return "swe";
+                case 22:
+                    return "pl";
+                case 23:
+                    return "dan";
+                case 24:
+                    return "rom";
+                case 25:
+                    return "hu";
+                default:
+                    return"";
+            }
+        }
     }
 }
 

+ 26 - 14
PDF Office/Helper/ServiceHelper.cs

@@ -287,12 +287,22 @@ namespace PDF_Master.Helper
                     {
                         App.IsLogin = true;
                         Settings.Default.UserDate.Email= jobject["email"].ToObject<string>().ToLower();
-                        Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
-                        Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
-                        if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
-                        {
-                            Settings.Default.UserDate.isInFreeUseTime = false;
-                        }
+                        Settings.Default.UserDate.id= jobject["id"].ToObject<string>().ToLower();
+                        //Settings.Default.UserDate.subscribed= jobject["subscribed"].ToObject<string>().ToLower();
+                        Settings.Default.UserDate.subscribed= "0";
+                        //Settings.Default.UserDate.subscriberType = jobject["subscriberType"].ToObject<string>().ToLower();
+                        Settings.Default.UserDate.subscriberType = "0";
+                        //Settings.Default.UserDate.subscriptionendDate = jobject["subscriptionendDate"].ToObject<string>().ToLower();
+                        Settings.Default.UserDate.subscriptionendDate = "2023-06-01 08:00:00";
+
+                        #region 试用策略
+                        //Settings.Default.UserDate.isInFreeUseTime= jobject["isInFreeUseTime"].ToObject<bool>();
+                        //Settings.Default.UserDate.freeDate= jobject["freeDate"].ToObject<string>().ToLower();
+                        //if(DateTime.Parse(Settings.Default.UserDate.freeDate)<=DateTime.Now)
+                        //{
+                        //    Settings.Default.UserDate.isInFreeUseTime = false;
+                        //}
+                        #endregion
                         App.mainWindowViewModel.Useremailchar = Settings.Default.UserDate.Email.Substring(0, 1);
                         Settings.Default.Save();
                         return "ture";
@@ -312,10 +322,11 @@ namespace PDF_Master.Helper
                     //从网络异常信息里解析错误,后面的逻辑根据错误码判断会更准确
                     statusCode = (int)((HttpWebResponse)e.Response).StatusCode;
                 }
-                if (DateTime.Parse(Settings.Default.UserDate.freeDate) <= DateTime.Now)
-                {
-                    Settings.Default.UserDate.isInFreeUseTime = false;
-                }
+                //试用策略注释
+                //if (DateTime.Parse(Settings.Default.UserDate.freeDate) <= DateTime.Now)
+                //{
+                //    Settings.Default.UserDate.isInFreeUseTime = false;
+                //}
                 Console.WriteLine(e.Message);
                 //无权限
                 if (Settings.Default.AppProperties.LoginToken == "")
@@ -329,10 +340,11 @@ namespace PDF_Master.Helper
             }
             catch
             {
-                if (DateTime.Parse(Settings.Default.UserDate.freeDate) <= DateTime.Now)
-                {
-                    Settings.Default.UserDate.isInFreeUseTime = false;
-                }
+                //试用策略注释
+                //if (DateTime.Parse(Settings.Default.UserDate.freeDate) <= DateTime.Now)
+                //{
+                //    Settings.Default.UserDate.isInFreeUseTime = false;
+                //}
                 return "300";
             }
            

+ 88 - 26
PDF Office/ViewModels/Dialog/ChatGPTAIDialogs/DocumentaryTranslationDialogViewModel.cs

@@ -1,7 +1,11 @@
-using Microsoft.Win32;
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using Microsoft.Win32;
 using PDF_Master.Helper;
+using PDF_Master.Model;
 using Prism.Commands;
 using Prism.Mvvm;
+using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
@@ -11,44 +15,79 @@ namespace PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs
 {
     public class DocumentaryTranslationDialogViewModel : BindableBase, IDialogAware
     {
+
+        public IRegionManager regionManager;
+
+        public CPDFViewer PDFViewer;
+
+        private CPDFViewer pdfViewer = null;
+
+        private string fromlanguage = "";
+
+        private string tolanguage = "";
+
+        private int fromlanguageIndex = 0;
+        public int FromlanguageIndex
+        {
+            get { return fromlanguageIndex; }
+            set
+            {
+                SetProperty(ref fromlanguageIndex, value);
+                fromlanguage=ChatGTPAIHelper.UpdateLanguagebType(value);
+            }
+        }
+
+        private int tolanguageIndex = 0;
+        public int TolanguageIndex
+        {
+            get { return tolanguageIndex; }
+            set
+            {
+                SetProperty(ref tolanguageIndex, value);
+                tolanguage = ChatGTPAIHelper.UpdateLanguagebType(value+1);
+            }
+        }
+
+        public static List<string> FromlanguageFamily { set; get; } = new List<string>();
+
+        public string ViewerRegionName { get; set; }
+
+        private void GetFromlanguageOrigin()
+        {
+            FromlanguageFamily.Clear();
+            FromlanguageFamily = ChatGTPAIHelper.SetFromlanguageOrigin();
+        }
+        public List<string> TolanguageFamily { set; get; } = new List<string>();
+
+        private void GetTolanguageOrigin()
+        {
+            TolanguageFamily.Clear();
+            TolanguageFamily = ChatGTPAIHelper.SetTolanguageOrigin();
+        }
+
         public DelegateCommand TranslateCommand { get; set; }
         public DelegateCommand CancelCommand { get; set; }
-        public DocumentaryTranslationDialogViewModel()
+        public DocumentaryTranslationDialogViewModel(IRegionManager regionManager)
         {
+            this.regionManager = regionManager;
             CancelCommand = new DelegateCommand(cancel);
             TranslateCommand = new DelegateCommand(translate);
+            ViewerRegionName = Guid.NewGuid().ToString();
+            init();
         }
 
+        private void init()
+        {
+            GetFromlanguageOrigin();
+            GetTolanguageOrigin();
+        }
         private void cancel()
         {
             RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
         }
         public async void translate()
         {
-            string txt = Properties.Resources.txtex;
-            string word = Properties.Resources.wordex;
-            string ppt = Properties.Resources.pptex;
-            string excel = Properties.Resources.excelex;
-            string html = Properties.Resources.htmlex;
-            string image = Properties.Resources.imageex;
-            string pdf = Properties.Resources.pdf;
-            string allfiles = pdf + txt + word + excel + ppt + image + html;
-            OpenFileDialog dialog = new OpenFileDialog();
-            //dialog.Multiselect = true;
-            dialog.Filter = string.Format($"Files({allfiles.Replace(";", ",")}|{allfiles})|" +
-           $"Pdf({pdf})|{pdf}|" +
-           $"Microsoft Office Word({word})|{word}|" +
-           $"Microsoft Office Excel({excel})|{excel}|" +
-           $"Microsoft Office PowerPoint({ppt})|{ppt}|" +
-           $"Txt({txt})|{txt}|" +
-           $"Picture({image})|{image}|" +
-           $"Html({html})|{html}");
-
-            if ((bool)dialog.ShowDialog())
-            {
-                await ChatGTPAIHelper.fileTranslate(dialog.FileName, "en", "zh");
-            }
-
+            await ChatGTPAIHelper.fileTranslate(pdfViewer.Document.FilePath, fromlanguage, tolanguage);
         }
 
         public string Title => "";
@@ -66,6 +105,29 @@ namespace PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
+
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
+            if (pdfViewer != null)
+            {
+                if (!regionManager.Regions[ViewerRegionName].Views.Contains(pdfViewer))
+                {
+                    PDFViewer = new CPDFViewer();
+                    PDFViewer.InitDocument(pdfViewer.Document);
+                    //Document = PDFViewer.Document;
+                    //pdfViewer.CustomDrawHandler += CurrentViewer_CustomDrawHandler;
+                    //pdfViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+                    regionManager.AddToRegion(ViewerRegionName, PDFViewer);
+                    PDFViewer.SetAnnotInteraction(!PDFViewer.GetAnnotInteraction());
+                    PDFViewer.Load();
+                    PDFViewer.ChangeFitMode(FitMode.FitHeight);
+                    PDFViewer.ChangeViewMode(ViewMode.Single);
+                    PDFViewer.SetMouseMode(MouseModes.PanTool);
+                    fromlanguage = ChatGTPAIHelper.UpdateLanguagebType(0);
+                    tolanguage = ChatGTPAIHelper.UpdateLanguagebType(1);
+                    //PageRangeNumber = PDFViewer.Document.PageCount;
+                    //PDFViewer.Zoom(0.1);
+                }
+            }
         }
     }
 }

+ 50 - 1
PDF Office/ViewModels/Dialog/ChatGPTAIDialogs/SelectedTranslationDialogViewModel.cs

@@ -40,18 +40,65 @@ namespace PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs
             }
         }
 
+        private string fromlanguage = "";
+
+        private string tolanguage = "";
+
+        private int fromlanguageIndex = 0;
+        public int FromlanguageIndex
+        {
+            get { return fromlanguageIndex; }
+            set
+            {
+                SetProperty(ref fromlanguageIndex, value);
+                fromlanguage = ChatGTPAIHelper.UpdateLanguagebType(value);
+            }
+        }
+
+        private int tolanguageIndex = 0;
+        public int TolanguageIndex
+        {
+            get { return tolanguageIndex; }
+            set
+            {
+                SetProperty(ref tolanguageIndex, value);
+                tolanguage = ChatGTPAIHelper.UpdateLanguagebType(value + 1);
+            }
+        }
+
+        public static List<string> FromlanguageFamily { set; get; } = new List<string>();
+        private void GetFromlanguageOrigin()
+        {
+            FromlanguageFamily.Clear();
+            FromlanguageFamily = ChatGTPAIHelper.SetFromlanguageOrigin();
+        }
+        public List<string> TolanguageFamily { set; get; } = new List<string>();
+
+        private void GetTolanguageOrigin()
+        {
+            TolanguageFamily.Clear();
+            TolanguageFamily = ChatGTPAIHelper.SetTolanguageOrigin();
+        }
+
         public DelegateCommand TranslateCommand { get; set; }
         public DelegateCommand CopyCommand { get; set; }
         public SelectedTranslationDialogViewModel()
         {
             TranslateCommand = new DelegateCommand(translate);
             CopyCommand = new DelegateCommand(copy);
+            init();
+        }
+
+        private void init()
+        {
+            GetFromlanguageOrigin();
+            GetTolanguageOrigin();
         }
 
         public void translate()
         {
             string translatetext = "";
-            ChatGTPAIHelper.textTranslate(SelectedText, "en", "zh", ref translatetext);
+            ChatGTPAIHelper.textTranslate(SelectedText, fromlanguage, tolanguage, ref translatetext);
             TranslateText = translatetext;
         }
         public void copy()
@@ -81,6 +128,8 @@ namespace PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs
             if (pdfViewer != null)
             {
                 SelectedText = pdfViewer.GetSelectedText();
+                fromlanguage = ChatGTPAIHelper.UpdateLanguagebType(0);
+                tolanguage = ChatGTPAIHelper.UpdateLanguagebType(1);
             }
         }
     }

+ 47 - 1
PDF Office/ViewModels/HomePanel/ChatGPTAI/ChatGPTAITranslationContentViewModel.cs

@@ -12,10 +12,56 @@ namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
     public class ChatGPTAITranslationContentViewModel : BindableBase
     {
 
+        private string fromlanguage = ChatGTPAIHelper.UpdateLanguagebType(0);
+
+        private string tolanguage = ChatGTPAIHelper.UpdateLanguagebType(1);
+
+        private int fromlanguageIndex = 0;
+        public int FromlanguageIndex
+        {
+            get { return fromlanguageIndex; }
+            set
+            {
+                SetProperty(ref fromlanguageIndex, value);
+                fromlanguage = ChatGTPAIHelper.UpdateLanguagebType(value);
+            }
+        }
+
+        private int tolanguageIndex = 0;
+        public int TolanguageIndex
+        {
+            get { return tolanguageIndex; }
+            set
+            {
+                SetProperty(ref tolanguageIndex, value);
+                tolanguage = ChatGTPAIHelper.UpdateLanguagebType(value + 1);
+            }
+        }
+
+        public static List<string> FromlanguageFamily { set; get; } = new List<string>();
+        private void GetFromlanguageOrigin()
+        {
+            FromlanguageFamily.Clear();
+            FromlanguageFamily = ChatGTPAIHelper.SetFromlanguageOrigin();
+        }
+        public List<string> TolanguageFamily { set; get; } = new List<string>();
+
+        private void GetTolanguageOrigin()
+        {
+            TolanguageFamily.Clear();
+            TolanguageFamily = ChatGTPAIHelper.SetTolanguageOrigin();
+        }
         public DelegateCommand SelectFilesCommand { get; set; }
         public ChatGPTAITranslationContentViewModel()
         {
             SelectFilesCommand = new DelegateCommand(selectFiles);
+            init();
+        }
+
+        private void init()
+        {
+            GetFromlanguageOrigin();
+            GetTolanguageOrigin();
         }
 
         public async void selectFiles() {
@@ -40,7 +86,7 @@ namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
 
             if ((bool)dialog.ShowDialog())
             {
-                await ChatGTPAIHelper.fileTranslate( dialog.FileName , "en", "zh");
+                await ChatGTPAIHelper.fileTranslate( dialog.FileName , fromlanguage, tolanguage);
             }
                 
         }

+ 3 - 2
PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs

@@ -147,8 +147,9 @@ namespace PDF_Master.ViewModels.HomePanel.PDFTools
                 dlg.Filter = Properties.Resources.imageex.ToLower() + "|*";
             }
             //付费锁 图片转PDF不用加锁
-         
-            if (toolItem.FnType != PDFFnType.ImageToPDF&&(!App.IsLogin || Settings.Default.UserDate.isInFreeUseTime == false) )
+
+            //删掉Settings.Default.UserDate.isInFreeUseTime == false,去掉试用策略
+            if (toolItem.FnType != PDFFnType.ImageToPDF&&(!App.IsLogin) )
             {
                 dialogs.ShowDialog(DialogNames.IAPCompareDialog);
                 return ;

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

@@ -374,6 +374,12 @@ namespace PDF_Master.ViewModels
 
                     LoginVis = Visibility.Visible;
                     OphVis = Visibility.Visible;
+                    if (Settings.Default.UserDate.IsLoginoff == false)
+                    {
+                        App.mainWindowViewModel.OpenLoginoff();
+                        Settings.Default.UserDate.IsLoginoff = true;
+                        Settings.Default.Save();
+                    }
                 }
                 else
                 {
@@ -441,7 +447,12 @@ namespace PDF_Master.ViewModels
                     UserVis = Visibility.Collapsed;
                     LoginVis = Visibility.Visible;
                     OphVis = Visibility.Visible;
-                    OpenLoginoff();
+                    if (Settings.Default.UserDate.IsLoginoff == false)
+                    {
+                        App.mainWindowViewModel.OpenLoginoff();
+                        Settings.Default.UserDate.IsLoginoff = true;
+                        Settings.Default.Save();
+                    }
 
 
                 }

+ 30 - 14
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -24,6 +24,7 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using PDF_Master.EventAggregators;
 using Prism.Events;
+using System.Windows.Media.Imaging;
 
 namespace PDF_Master.ViewModels.Tools
 {
@@ -280,7 +281,9 @@ namespace PDF_Master.ViewModels.Tools
                         //缩小esc的操作范围
                         if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditText)
                         {
-                            PDFViewer.RemovePDFEditEmptyText();
+                            if(PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditText) ==0)
+                            {
+                              PDFViewer.RemovePDFEditEmptyText(); 
                             //只有在有画框的时候才进行
                             if (PDFViewer.MouseMode == MouseModes.PDFEdit&& PDFViewer.ToolManager.HasTool == true)
                             {
@@ -298,27 +301,40 @@ namespace PDF_Master.ViewModels.Tools
                                 PDFViewer.ReloadDocument();
                                 ShowPropertyPanel(false);
                             }
+                            }
+                            {
+                                PDFViewer.ClearSelectPDFEdit();
+                                PDFViewer.ReloadDocument();
+                            }
+                          
                         }
 
                         else if (PDFViewer.ToolManager != null && PDFViewer.GetPDFEditCreateType() == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                         {
-
-                            PDFViewer.RemovePDFEditEmptyText();
-                            if (PDFViewer.MouseMode == MouseModes.PDFEdit&&PDFViewer.ToolManager.HasTool == true)
+                            if (PDFViewer.GetPDFEditSelectionCount(ComPDFKit.PDFPage.CPDFEditType.EditImage) == 0)
                             {
-                                PDFViewer.RemoveTool(false);
+                                PDFViewer.RemovePDFEditEmptyText();
+                                if (PDFViewer.MouseMode == MouseModes.PDFEdit && PDFViewer.ToolManager.HasTool == true)
+                                {
+                                    PDFViewer.RemoveTool(false);
+                                }
+                                else if (IsTextEdit == true || IsImgEdit == true)
+                                {
+                                    IsImgEdit = false;
+                                    IsTextEdit = false;
+                                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
+
+                                    //文本和图像都框选
+                                    PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
+                                    PDFViewer.SetMouseMode(MouseModes.PDFEdit);
+                                    PDFViewer.ReloadDocument();
+                                    ShowPropertyPanel(false);
+                                }
                             }
-                            else if (IsTextEdit == true || IsImgEdit == true)
+                            else
                             {
-                                IsImgEdit = false;
-                                IsTextEdit = false;
-                                PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
-
-                                //文本和图像都框选
-                                PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.EditText | ComPDFKit.PDFPage.CPDFEditType.EditImage);
-                                PDFViewer.SetMouseMode(MouseModes.PDFEdit);      
+                                PDFViewer.ClearSelectPDFEdit();
                                 PDFViewer.ReloadDocument();
-                                ShowPropertyPanel(false);
                             }
                         }
                         

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

@@ -2332,6 +2332,13 @@ namespace PDF_Master.ViewModels
                         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
@@ -2343,7 +2350,8 @@ namespace PDF_Master.ViewModels
             }
 
             //付费锁
-            if (!App.IsLogin || Settings.Default.UserDate.isInFreeUseTime == false)
+            //删掉 Settings.Default.UserDate.isInFreeUseTime == false,没有试用期了;
+            if (!App.IsLogin )
             {
                 dialogs.ShowDialog(DialogNames.IAPCompareDialog);
                 return false;
@@ -2714,7 +2722,8 @@ namespace PDF_Master.ViewModels
         {
             try
             {
-                if (!App.IsLogin || Settings.Default.UserDate.isInFreeUseTime == false)
+               //删掉Settings.Default.UserDate.isInFreeUseTime == false,没有试用期策略了
+                if (!App.IsLogin)
                 {
                     dialogs.ShowDialog(DialogNames.SubscriptionDialog);
                     return false;

文件差异内容过多而无法显示
+ 8 - 7
PDF Office/Views/Dialog/ChatGPTAIDialogs/DocumentaryTranslationDialog.xaml


+ 10 - 2
PDF Office/Views/Dialog/ChatGPTAIDialogs/DocumentaryTranslationDialog.xaml.cs

@@ -1,4 +1,6 @@
-using System.Windows.Controls;
+using Prism.Ioc;
+using Prism.Regions;
+using System.Windows.Controls;
 
 namespace PDF_Master.Views.Dialog.ChatGPTAIDialogs
 {
@@ -7,9 +9,15 @@ namespace PDF_Master.Views.Dialog.ChatGPTAIDialogs
     /// </summary>
     public partial class DocumentaryTranslationDialog : UserControl
     {
-        public DocumentaryTranslationDialog()
+        private IContainerProvider containerProvider;
+       
+        public DocumentaryTranslationDialog(IContainerProvider containerProvider)
         {
             InitializeComponent();
+            this.containerProvider = containerProvider;
+            var regionManager = containerProvider.Resolve<IRegionManager>();
+            RegionManager.SetRegionManager(this, regionManager);
+            RegionManager.UpdateRegions();
         }
     }
 }

文件差异内容过多而无法显示
+ 3 - 3
PDF Office/Views/Dialog/ChatGPTAIDialogs/SelectedTranslationDialog.xaml


+ 7 - 7
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAIErrorCorrectionContent.xaml

@@ -11,13 +11,13 @@
       mc:Ignorable="d"  
       d:DesignHeight="760" d:DesignWidth="1032"
      >
-    <Grid>
+    <Grid Margin="32,0,32,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="*" />
             <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <StackPanel Grid.Row="0">
-            <Grid  Width="968">
+            <Grid  >
                 <StackPanel HorizontalAlignment="Left">
                     <TextBlock Text="AI Error Correction" FontFamily="Segoe UI"
             FontSize="20"
@@ -35,21 +35,21 @@
                 </StackPanel>
                 <Button HorizontalAlignment="Right" Width="104" Height="32" Content="ErrorCorrection" VerticalAlignment="Bottom" Style="{StaticResource Btn.cta}" Command="{Binding ErrorCorrectionCommand}"></Button>
             </Grid>
-            <Grid Width="968" Height="260" Margin="0,12,0,0">
-                <TextBox Name="textBoxEnterCharacters" Width="968" Height="260" Text="{Binding InputText}">
+            <Grid Height="260" Margin="0,12,0,0">
+                <TextBox Name="textBoxEnterCharacters"  Height="260" Text="{Binding InputText}">
                 </TextBox>
-                <TextBlock Text="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length,StringFormat={}{0:/150}}" Panel.ZIndex="1" Height="22" FontSize="14" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,12,8"/>
+                <TextBlock Text="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length,StringFormat={}{0}/150}" Panel.ZIndex="1" Height="22" FontSize="14" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,12,8"/>
             </Grid>
         </StackPanel>
         <StackPanel Grid.Row="1">
-            <Grid Width="968">
+            <Grid >
                 <TextBlock Text="Result" FontFamily="Segoe UI"
             FontSize="20"
             FontWeight="Bold"
             Foreground="{StaticResource color.sys.text.neutral.lv1}" Height="28" HorizontalAlignment="Left"></TextBlock>
                 <Button HorizontalAlignment="Right" Width="104" Height="32" Content="Copy" Background="White" Command="{Binding CopyCommand}"></Button>
             </Grid>
-            <TextBox Width="968" Height="260" Margin="0,12,0,0" Text="{Binding ErrorCorrectionText}">
+            <TextBox  Height="260" Margin="0,12,0,0" Text="{Binding ErrorCorrectionText}">
 
             </TextBox>
         </StackPanel>

+ 7 - 7
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAIRewritingContent.xaml

@@ -11,13 +11,13 @@
       mc:Ignorable="d"  
       d:DesignHeight="760" d:DesignWidth="1032"
      >
-    <Grid>
+    <Grid Margin="32,0,32,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="*" />
             <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <StackPanel Grid.Row="0">
-            <Grid  Width="968">
+            <Grid  >
                 <StackPanel HorizontalAlignment="Left">
                     <TextBlock Text="AI Rewriting" FontFamily="Segoe UI"
             FontSize="20"
@@ -35,21 +35,21 @@
                 </StackPanel>
                 <Button HorizontalAlignment="Right" Width="104" Height="32" Content="Rewrite" VerticalAlignment="Bottom" Style="{StaticResource Btn.cta}" Command="{Binding RewriteCommand}"></Button>
             </Grid>
-            <Grid Width="968" Height="260" Margin="0,12,0,0">
-                <TextBox Name="textBoxEnterCharacters" Width="968" Height="260" Text="{Binding InputText}">
+            <Grid  Height="260" Margin="0,12,0,0">
+                <TextBox Name="textBoxEnterCharacters"  Height="260" Text="{Binding InputText}">
                 </TextBox>
-                <TextBlock Text="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length,StringFormat={}{0:/150}}" Panel.ZIndex="1" Height="22" FontSize="14" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,12,8"/>
+                <TextBlock Text="{Binding ElementName=textBoxEnterCharacters,Path=Text.Length,StringFormat={}{0}/150}" Panel.ZIndex="1" Height="22" FontSize="14" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,12,8"/>
             </Grid>
         </StackPanel>
         <StackPanel Grid.Row="1">
-            <Grid Width="968">
+            <Grid >
                 <TextBlock Text="Result" FontFamily="Segoe UI"
             FontSize="20"
             FontWeight="Bold"
             Foreground="{StaticResource color.sys.text.neutral.lv1}" Height="28" HorizontalAlignment="Left"></TextBlock>
                 <Button HorizontalAlignment="Right" Width="104" Height="32" Content="Copy" Background="White" Command="{Binding CopyCommand}" ></Button>
             </Grid>
-            <TextBox Width="968" Height="260" Margin="0,12,0,0" Text="{Binding RewriteText}">
+            <TextBox  Height="260" Margin="0,12,0,0" Text="{Binding RewriteText}">
 
             </TextBox>
         </StackPanel>

文件差异内容过多而无法显示
+ 4 - 4
PDF Office/Views/HomePanel/ChatGPTAI/ChatGPTAITranslationContent.xaml


文件差异内容过多而无法显示
+ 5 - 5
PDF Office/Views/HomePanel/PDFTools/HomeFilesContent.xaml


+ 5 - 0
PDFSettings/UserDate.cs

@@ -16,6 +16,8 @@ using System.Threading.Tasks;
         public bool TodayRegister { get; set; } = false;
         public string TodayRegisterTime { get; set; } = "2023-06-01 08:00:00";
 
+        public bool IsLoginoff { get; set; } = false;
+
         public string id { get; set; }
         public string companyId { get; set; }
         public string appId { get; set; }
@@ -49,6 +51,9 @@ using System.Threading.Tasks;
         public string validFlag { get; set; }
 
         public List<string> subscriptionInfoList { get; set; }
+
+        public string subscriptionendDate { get; set; }
+
         public string freeDate { get; set; } = "2023-06-01 08:00:00";
         public bool isInFreeUseTime { get; set; } = false;