|
@@ -1,6 +1,8 @@
|
|
|
using PDF_Master.Helper;
|
|
|
+using PDF_Master.Model;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Mvvm;
|
|
|
+using Prism.Regions;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -10,9 +12,11 @@ using System.Windows.Forms;
|
|
|
|
|
|
namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
|
|
|
{
|
|
|
- public class ChatGPTAIErrorCorrectionContentViewModel : BindableBase
|
|
|
+ public class ChatGPTAIErrorCorrectionContentViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
|
|
|
+ public HomeContentViewModel homeContentViewModel = null;
|
|
|
+
|
|
|
private string inputText;
|
|
|
|
|
|
public string InputText
|
|
@@ -48,7 +52,7 @@ namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private string errorTipText= "Limit 150 characters at a time";
|
|
|
+ private string errorTipText = "Limit 150 characters at a time";
|
|
|
|
|
|
public string ErrorTipText
|
|
|
{
|
|
@@ -86,7 +90,7 @@ namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
|
|
|
try
|
|
|
{
|
|
|
System.Windows.Forms.Clipboard.SetText(ErrorCorrectionText);
|
|
|
- ShowTip=Visibility.Visible;
|
|
|
+ ShowTip = Visibility.Visible;
|
|
|
}
|
|
|
catch { }
|
|
|
|
|
@@ -94,14 +98,43 @@ namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
|
|
|
|
|
|
public async void errorCorrection()
|
|
|
{
|
|
|
-
|
|
|
+ ////添加付费拦截锁
|
|
|
+ //if (!ViewContentViewModel.IAPBeforeFunction())
|
|
|
+ //{
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
+ if (homeContentViewModel != null)
|
|
|
+ {
|
|
|
+ homeContentViewModel.IsLoading = Visibility.Visible;
|
|
|
+ }
|
|
|
+ ErrorVisible = Visibility.Collapsed;
|
|
|
await Task.Run(async delegate
|
|
|
{
|
|
|
ErrorCorrectionText = await ChatGTPAIHelper.Correction(InputText);
|
|
|
});
|
|
|
- if (ChatGTPAIHelper.Code != "200") {
|
|
|
- ErrorVisible=Visibility.Visible;
|
|
|
+ if (ChatGTPAIHelper.Code != "200")
|
|
|
+ {
|
|
|
+ ErrorTipText = ChatGTPAIHelper.Code;
|
|
|
+ ErrorVisible = Visibility.Visible;
|
|
|
}
|
|
|
+ if (homeContentViewModel != null)
|
|
|
+ {
|
|
|
+ homeContentViewModel.IsLoading = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ navigationContext.Parameters.TryGetValue<HomeContentViewModel>(ParameterNames.HomeContentViewModel, out homeContentViewModel);
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|