using ComPDFKitViewer.PdfViewer;
using PDF_Master.Model;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using PDF_Master.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Resources.ResXFileRef;
using static System.Net.Mime.MediaTypeNames;
using System.Windows.Forms;
using Microsoft.Office.Core;
using System.Threading.Tasks;
using System.Windows;
using PDF_Master.Properties;
using PDF_Master.CustomControl;
using DialogResult = Prism.Services.Dialogs.DialogResult;
namespace PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs
{
public class SelectedTranslationDialogViewModel : BindableBase, IDialogAware
{
#region 文案
private string T_title;
public string T_Title
{
get { return T_title; }
set
{
SetProperty(ref T_title, value);
}
}
private string T_limitTip;
public string T_LimitTip
{
get { return T_limitTip; }
set
{
SetProperty(ref T_limitTip, value);
}
}
private string T_textBoxWatermark;
public string T_TextBoxWatermark
{
get { return T_textBoxWatermark; }
set
{
SetProperty(ref T_textBoxWatermark, value);
}
}
private string T_copy;
public string T_Copy
{
get { return T_copy; }
set
{
SetProperty(ref T_copy, value);
}
}
private string T_result;
public string T_Result
{
get { return T_result; }
set
{
SetProperty(ref T_result, value);
}
}
private string T_translationBtn;
public string T_TranslationBtn
{
get { return T_translationBtn; }
set
{
SetProperty(ref T_translationBtn, value);
}
}
private string T_translationLanguage;
public string T_TranslationLanguage
{
get { return T_translationLanguage; }
set
{
SetProperty(ref T_translationLanguage, value);
}
}
private string T_copied;
public string T_Copied
{
get { return T_copied; }
set
{
SetProperty(ref T_copied, value);
}
}
private void InitString()
{
T_Title = App.HomePageLoader.GetString("ViewRightMenuText_AITranslationTitle");
T_LimitTip = App.HomePageLoader.GetString("AISelectTranslationBtn_LimitTip");
T_TextBoxWatermark = App.HomePageLoader.GetString("ChatGTPAI_TextBoxWatermark");
T_TranslationLanguage = App.HomePageLoader.GetString("AITranslationBtn_TranslationLanguage");
T_Copy = App.HomePageLoader.GetString("ChatGTPAI_Copy");
T_Result = App.HomePageLoader.GetString("ChatGTPAI_Result");
T_TranslationBtn = App.HomePageLoader.GetString("ViewRightMenuText_AITranslationBtn");
T_Copied = App.HomePageLoader.GetString("ChatGTPAI_Copied");
}
#endregion
#region 参数和属性
public string Title => "";
private string selectedText;
public string SelectedText
{
get { return selectedText; }
set
{
SetProperty(ref selectedText, value);
}
}
private string translateText;
public string TranslateText
{
get { return translateText; }
set
{
SetProperty(ref translateText, value);
}
}
private string errorTipText;
public string ErrorTipText
{
get { return errorTipText; }
set
{
SetProperty(ref errorTipText, value);
}
}
///
/// 错误框显示
///
private Visibility errorVisible = Visibility.Collapsed;
public Visibility ErrorVisible
{
get
{
return errorVisible;
}
set
{
SetProperty(ref errorVisible, value);
}
}
///
/// 进度条显示
///
private Visibility progressVisible = Visibility.Collapsed;
public Visibility ProgressVisible
{
get
{
return progressVisible;
}
set
{
SetProperty(ref progressVisible, value);
}
}
private double processvalue = 0;
///
/// 进度条当前值
///
public double Value
{
get { return processvalue; }
set
{
SetProperty(ref processvalue, value);
}
}
private double maxValue = 10;
///
/// 进度条最大值
///
public double MaxValue
{
get { return maxValue; }
set
{
SetProperty(ref maxValue, value);
}
}
private Visibility showTip = Visibility.Collapsed;
public Visibility ShowTip
{
get
{
return showTip;
}
set
{
SetProperty(ref showTip, value);
}
}
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 FromlanguageFamily { set; get; } = new List();
private void GetFromlanguageOrigin()
{
FromlanguageFamily.Clear();
FromlanguageFamily = ChatGTPAIHelper.SetFromlanguageOrigin();
}
public List TolanguageFamily { set; get; } = new List();
private void GetTolanguageOrigin()
{
TolanguageFamily.Clear();
TolanguageFamily = ChatGTPAIHelper.SetTolanguageOrigin();
}
#endregion
#region 委托声明
public DelegateCommand TranslateCommand { get; set; }
public DelegateCommand CopyCommand { get; set; }
public DelegateCommand