This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
BulkDialog.cs
123 lines (106 loc) · 3.66 KB
/
BulkDialog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VietOCR.NET.Utilities;
using System.Globalization;
namespace VietOCR.NET
{
public partial class BulkDialog : Form
{
private string inputFolder;
public string InputFolder
{
get { return inputFolder; }
set { inputFolder = value; }
}
private string outputFolder;
public string OutputFolder
{
get { return outputFolder; }
set { outputFolder = value; }
}
public string OutputFormat
{
get { return this.comboBoxOutputFormat.SelectedItem.ToString(); }
set
{
this.comboBoxOutputFormat.SelectedItem = value;
if (this.comboBoxOutputFormat.SelectedIndex == -1) this.comboBoxOutputFormat.SelectedIndex = 0;
}
}
public BulkDialog()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs ea)
{
base.OnLoad(ea);
this.textBoxInput.Text = inputFolder;
this.textBoxOutput.Text = outputFolder;
this.toolTip1.SetToolTip(this.btnInput, Properties.Resources.Browse);
this.toolTip1.SetToolTip(this.btnOutput, Properties.Resources.Browse);
}
protected override void OnClosed(EventArgs ea)
{
base.OnClosed(ea);
inputFolder = this.textBoxInput.Text;
outputFolder = this.textBoxOutput.Text;
}
private void btnInput_Click(object sender, EventArgs e)
{
this.folderBrowserDialog1.Description = "Set Input Image Folder.";
this.folderBrowserDialog1.SelectedPath = inputFolder;
if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
inputFolder = this.folderBrowserDialog1.SelectedPath;
this.textBoxInput.Text = inputFolder;
}
}
private void btnOutput_Click(object sender, EventArgs e)
{
this.folderBrowserDialog1.Description = "Set Output Folder.";
this.folderBrowserDialog1.SelectedPath = outputFolder;
if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
outputFolder = this.folderBrowserDialog1.SelectedPath;
this.textBoxOutput.Text = outputFolder;
}
}
/// <summary>
/// Changes localized text and messages
/// </summary>
/// <param name="locale"></param>
public virtual void ChangeUILanguage(string locale)
{
FormLocalizer localizer = new FormLocalizer(this, typeof(BulkDialog));
localizer.ApplyCulture(new CultureInfo(locale));
}
private void comboBoxOutputFormat_MouseHover(object sender, EventArgs e)
{
string val = this.comboBoxOutputFormat.SelectedItem.ToString();
switch (val)
{
case "text+":
val = "Text with postprocessing";
break;
case "text":
val = "Text with no postprocessing";
break;
case "pdf":
val = "PDF";
break;
case "hocr":
val = "hOCR";
break;
default:
val = null;
break;
}
this.toolTip1.SetToolTip(this.comboBoxOutputFormat, val);
}
}
}