|
@@ -4,6 +4,7 @@ using ImTools;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using PDF_Master.Properties;
|
|
|
+using PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
@@ -75,6 +76,23 @@ namespace PDF_Master.Helper
|
|
|
|
|
|
ServicePointManager.DefaultConnectionLimit = 200;
|
|
|
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Uri_fileKeytranslate);
|
|
|
+ //关闭请求
|
|
|
+ //弹窗内进度条关闭
|
|
|
+ DocumentaryTranslationDialogViewModel.CancelProgress = () =>
|
|
|
+ {
|
|
|
+ if (request != null)
|
|
|
+ {
|
|
|
+ request.Abort();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ //进度条关闭
|
|
|
+ App.mainWindowViewModel.ProcessCloseAction = () =>
|
|
|
+ {
|
|
|
+ if (request != null)
|
|
|
+ {
|
|
|
+ request.Abort();
|
|
|
+ }
|
|
|
+ };
|
|
|
request.Method = "Post";
|
|
|
//request.Accept = "application/vnd.api+json;version=1";
|
|
|
request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
|
|
@@ -177,7 +195,7 @@ namespace PDF_Master.Helper
|
|
|
/// <returns></returns>
|
|
|
public static async Task<string> fileTranslate(string content, string fromlanguage, string tolanguage, bool isprocess = true)
|
|
|
{
|
|
|
- intProcess(isprocess,"Translating");
|
|
|
+ intProcess(isprocess,"Translating", System.Windows.Visibility.Visible);
|
|
|
|
|
|
FileInfo file = new FileInfo(content);
|
|
|
string fileKey = await fileKeyTranslate(content, file.Name);
|
|
@@ -191,7 +209,14 @@ namespace PDF_Master.Helper
|
|
|
ServicePointManager.DefaultConnectionLimit =200;
|
|
|
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Uri_filetranslate);
|
|
|
//关闭请求
|
|
|
- App.mainWindowViewModel.ProcessCloseBtnVisible = System.Windows.Visibility.Visible;
|
|
|
+ DocumentaryTranslationDialogViewModel.CancelProgress=()=>
|
|
|
+ {
|
|
|
+ if (request != null)
|
|
|
+ {
|
|
|
+ request.Abort();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
App.mainWindowViewModel.ProcessCloseAction = () =>
|
|
|
{
|
|
|
if (request != null)
|