示例#1
0
 private static QueueThread Instance()
 {
     if (singleton == null)
     {
         singleton = new QueueThread();
     }
     return(singleton);
 }
示例#2
0
 public void ShowMessage(String msg)
 {
     QueueThread.InvokeControl(statusStrip1, () =>
     {
         toolStripProgressBar1.Visible = true;
         toolStripStatusLabel1.Text    = msg;
     });
 }
示例#3
0
 public void HideMessage()
 {
     QueueThread.InvokeControl(statusStrip1, () =>
     {
         toolStripProgressBar1.Visible = false;
         toolStripStatusLabel1.Text    = "Ready...";
     });
 }
示例#4
0
 private void EnableControl(bool enable)
 {
     QueueThread.InvokeForm(this, () =>
     {
         button1.Enabled   = enable;
         button2.Enabled   = enable;
         button3.Enabled   = enable;
         comboBox1.Enabled = enable;
         comboBox2.Enabled = enable;
     });
 }
示例#5
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text.Trim()))
            {
                MessageBox.Show("Please select the image file...");
            }
            QueueThread.Push(() =>
            {
                try
                {
                    EnableControl(false);
                    ShowMessage("Extracting...");
                    int index = QueueThread.InvokeControl(comboBox1, () =>
                    {
                        return(comboBox1.SelectedIndex);
                    });
                    String img = QueueThread.InvokeControl(textBox1, () =>
                    {
                        return(textBox1.Text.Trim());
                    });
                    String path = QueueThread.InvokeControl(textBox2, () =>
                    {
                        return(textBox2.Text.Trim());
                    });
                    int ocrtype = QueueThread.InvokeControl(comboBox2, () =>
                    {
                        return(comboBox2.SelectedIndex);
                    });
                    String text = "";

                    /*if (ocrtype == 1)
                     * {
                     *  text = MODIOCRConverter.Run(img);
                     * }
                     * else
                     * {
                     *  text = TessecratOCRConverter.Run(tessdatapath, index == 0 ? TessecratOCRConverter.LanguageType.ENG : TessecratOCRConverter.LanguageType.JPN, img);
                     * }*/
                    text = TessecratOCRConverter.Run(tessdatapath, index == 0 ? TessecratOCRConverter.LanguageType.ENG : TessecratOCRConverter.LanguageType.JPN, img);
                    ShowMessage("Saving...");
                    SaveFile(path, outputfile, text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    HideMessage();
                    EnableControl(true);
                }
            });
        }
示例#6
0
        public Main()
        {
            InitializeComponent();
            QueueThread.Start();
            comboBox1.Items.Add("ENG");
            comboBox1.Items.Add("JPN");
            comboBox2.Items.Add("GOOGLE(Tessecrat)");
            comboBox2.Items.Add("MS(MODI)");
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            this.MaximumSize        = this.Size;

            tessdatapath = Path.GetDirectoryName(Application.ExecutablePath);
            outputfile   = "output.txt";
        }