|
@@ -73,7 +73,9 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
SetProperty(ref T_pageRange, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private string _TextUpgrade;
|
|
|
+
|
|
|
public string TextUpgrade
|
|
|
{
|
|
|
get { return _TextUpgrade; }
|
|
@@ -89,13 +91,14 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
T_PageRange = App.MainPageLoader.GetString("Convert_PDFPageRange");
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion 文案
|
|
|
|
|
|
public string Title => "";
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
|
|
#region 参数和属性
|
|
|
+
|
|
|
public ConverterWordDialogModel ConverterWordModel = new ConverterWordDialogModel();
|
|
|
|
|
|
public CPDFViewer currentViewer;
|
|
@@ -111,6 +114,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
public string PageRangeSelectIndex { set; get; } = "0";
|
|
|
|
|
|
private int maxPageRange = 0;
|
|
|
+
|
|
|
public int MaxPageRange
|
|
|
{
|
|
|
get { return maxPageRange; }
|
|
@@ -121,6 +125,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
}
|
|
|
|
|
|
private bool oCRCheckBoxIsCheckBox = false;
|
|
|
+
|
|
|
public bool OCRCheckBoxIsCheckBox
|
|
|
{
|
|
|
get { return oCRCheckBoxIsCheckBox; }
|
|
@@ -132,6 +137,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
}
|
|
|
|
|
|
private int languageSelectedIndex = 2;
|
|
|
+
|
|
|
public int LanguageSelectedIndex
|
|
|
{
|
|
|
get { return languageSelectedIndex; }
|
|
@@ -139,7 +145,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
{
|
|
|
SetProperty(ref languageSelectedIndex, value);
|
|
|
SelectLanguage(languageSelectedIndex);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -158,7 +163,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
|
|
|
private void InitCheckPageSelect()
|
|
|
{
|
|
|
-
|
|
|
CheckPageSelect.Clear();
|
|
|
if (!IsCurrentPageIndex)
|
|
|
{
|
|
@@ -170,18 +174,18 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
CheckPageSelect.Add("0", "0");
|
|
|
CheckPageSelect.Add("1", "-2");
|
|
|
CheckPageSelect.Add("2", "1");
|
|
|
CheckPageSelect.Add("3", "2");
|
|
|
CheckPageSelect.Add("4", "3");
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
+ #endregion 参数和属性
|
|
|
|
|
|
#region 委托声明
|
|
|
+
|
|
|
public DelegateCommand<string> RadioButtonCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand CancelCommand { get; set; }
|
|
@@ -202,7 +206,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
|
|
|
public DelegateCommand OpenOCRCommand { get; set; }
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion 委托声明
|
|
|
|
|
|
public ConverterWordDialogViewModel(IDialogService dialogService)
|
|
|
{
|
|
@@ -219,8 +223,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
dialogs = dialogService;
|
|
|
IntString();
|
|
|
}
|
|
|
- #region 逻辑函数
|
|
|
|
|
|
+ #region 逻辑函数
|
|
|
|
|
|
private void openOCR()
|
|
|
{
|
|
@@ -243,7 +247,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
DialogParameters oCRDownloadProgress = new DialogParameters();
|
|
|
dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
|
|
|
{
|
|
|
-
|
|
|
if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
|
|
|
{
|
|
|
string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
|
|
@@ -261,16 +264,13 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
OCRCheckBoxIsCheckBox = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public void SetCustomPageRange()
|
|
|
{
|
|
|
if (PageRangeSelectIndex == CheckPageSelect["4"])
|
|
|
{
|
|
|
-
|
|
|
List<int> PageIndexLists = new List<int>();
|
|
|
if (!CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, currentViewer.Document.PageCount, new char[] { ',' }, new char[] { '-' }))
|
|
|
{ //TODO
|
|
@@ -289,7 +289,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
// //});
|
|
|
// return;
|
|
|
//}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -317,7 +316,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
{
|
|
|
if (PageRangeSelectIndex == CheckPageSelect["4"])
|
|
|
{
|
|
|
-
|
|
|
List<int> PageIndexLists = new List<int>();
|
|
|
if (!CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, currentViewer.Document.PageCount, new char[] { ',' }, new char[] { '-' }))
|
|
|
{ //TODO
|
|
@@ -336,7 +334,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
//});
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
|
|
@@ -365,7 +362,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
alertsMessage.ShowDialog("", App.MainPageLoader.GetString("FileNotExistWarning"), App.ServiceLoader.GetString("Text_ok"));
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -383,7 +379,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
char[] rangeSeparator = new char[] { '-' };
|
|
|
if (!CommonHelper.GetPagesInRange(ref ConverterWordModel.PageIndexLists, ConverterWordModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
|
|
|
{ //TODO
|
|
|
-
|
|
|
Trace.WriteLine("输入不对");
|
|
|
AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
|
|
@@ -400,7 +395,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
//RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
|
|
//dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
|
|
|
//{
|
|
|
-
|
|
|
//});
|
|
|
}
|
|
|
|
|
@@ -429,7 +423,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
if (PageRangeSelectIndex == CheckPageSelect["1"])
|
|
|
{
|
|
@@ -438,7 +431,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (currentViewer.CurrentIndex + 1).ToString()
|
|
|
, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
|
|
|
{ //TODO
|
|
|
-
|
|
|
Trace.WriteLine("输入不对");
|
|
|
AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
|
|
@@ -514,41 +506,47 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
case "FlowingTextRadioBtn":
|
|
|
ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainFlowingText;
|
|
|
break;
|
|
|
+
|
|
|
case "PageLayoutRadioBtn":
|
|
|
- ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainFlowingText;
|
|
|
+ ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainPageLayout;
|
|
|
break;
|
|
|
+
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectLanguage(int SelectedIndex)
|
|
|
{
|
|
|
-
|
|
|
switch (SelectedIndex)
|
|
|
{
|
|
|
case 0:
|
|
|
ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageChinese;
|
|
|
break;
|
|
|
+
|
|
|
case 1:
|
|
|
ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageChineseTraditional;
|
|
|
break;
|
|
|
+
|
|
|
case 2:
|
|
|
ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageEnglish;
|
|
|
break;
|
|
|
+
|
|
|
case 3:
|
|
|
ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageJapanese;
|
|
|
break;
|
|
|
+
|
|
|
case 4:
|
|
|
ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageKorean;
|
|
|
break;
|
|
|
+
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
+ #endregion 逻辑函数
|
|
|
|
|
|
#region 构架行为
|
|
|
|
|
@@ -582,6 +580,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
|
|
|
LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
|
|
|
}
|
|
|
}
|
|
|
- #endregion
|
|
|
+
|
|
|
+ #endregion 构架行为
|
|
|
}
|
|
|
-}
|
|
|
+}
|