Ejemplo n.º 1
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            IOcrSpellCheckManager ocrSpellCheckManager = _ocrEngine.SpellCheckManager;

            try
            {
                OcrSpellCheckEngine spellCheckEngine = (OcrSpellCheckEngine)_engineComboBox.SelectedItem;
                ocrSpellCheckManager.SpellCheckEngine = spellCheckEngine;
            }
            catch (Exception ex)
            {
                string msg = string.Format("{0}{1}Spell check engine will be set to 'None' now.", ex.Message, Environment.NewLine);
                MessageBox.Show(this, msg, "OCR Spell Check Engine", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                ocrSpellCheckManager.SpellCheckEngine = OcrSpellCheckEngine.None;
                _engineComboBox.SelectedItem          = ocrSpellCheckManager.SpellCheckEngine;
                DialogResult = DialogResult.None;
            }
        }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            if (!DesignMode)
            {
                IOcrSpellCheckManager ocrSpellCheckManager = _ocrEngine.SpellCheckManager;

                OcrSpellCheckEngine[] engines = ocrSpellCheckManager.GetSupportedSpellCheckEngines();
                foreach (OcrSpellCheckEngine engine in engines)
                {
                    _engineComboBox.Items.Add(engine);
                }

                _engineComboBox.SelectedItem = ocrSpellCheckManager.SpellCheckEngine;

                _helpButton.Visible = (_ocrEngine.EngineType == OcrEngineType.LEAD);
            }

            base.OnLoad(e);
        }
Ejemplo n.º 3
0
        public OcrEngineComponentsDialog(IOcrEngine ocrEngine)
        {
            InitializeComponent();

            // Find all the supported and additional languages
            string[] languages = ocrEngine.LanguageManager.GetSupportedLanguages();
            foreach (string language in languages)
            {
                string name = GetLanguageFriendlyName(language);
                _lbInstalledLanguages.Items.Add(name);
            }

            languages = ocrEngine.LanguageManager.GetAdditionalLanguages();
            if (languages.Length > 0)
            {
                _lbAdditionalLanguages.Visible    = true;
                _lblNoAdditionalLanguages.Visible = false;

                foreach (string language in languages)
                {
                    string name = GetLanguageFriendlyName(language);
                    _lbAdditionalLanguages.Items.Add(name);
                }
            }
            else
            {
                _lbAdditionalLanguages.Visible    = false;
                _lblNoAdditionalLanguages.Visible = true;
            }

            IOcrSpellCheckManager spellCheckManager = ocrEngine.SpellCheckManager;

            if (spellCheckManager != null)
            {
                string[] spellLanguages = spellCheckManager.GetSupportedSpellLanguages();
                foreach (string spellLanguage in spellLanguages)
                {
                    string name = GetLanguageFriendlyName(spellLanguage);
                    _lbInstalledDictionaries.Items.Add(name);
                }

                spellLanguages = spellCheckManager.GetAdditionalSpellLanguages();
                foreach (string spellLanguage in spellLanguages)
                {
                    string name = GetLanguageFriendlyName(spellLanguage);
                    _lbAdditionalDictionaries.Items.Add(name);
                }
            }
            else
            {
                _tabMain.TabPages.Remove(_tpDictionaries);
            }

            if (ocrEngine.EngineType == OcrEngineType.LEAD)
            {
                if (spellCheckManager != null && spellCheckManager.SpellCheckEngine == OcrSpellCheckEngine.Hunspell)
                {
                    _leadEngineDictionariesNoteLabel.Text = "Select OCR/Spell CheckEngine for the Hunspell spell check engine additional dictionaries support.";
                }
                else
                {
                    _leadEngineDictionariesNoteLabel.Text = DemosGlobalization.GetResxString(GetType(), "Resx_DictionariesSupport");
                }
            }
            else
            {
                _leadEngineDictionariesNoteLabel.Visible = false;
            }

            string[] installedEngineFormats  = ocrEngine.DocumentManager.GetSupportedEngineFormats();
            string[] additionalEngineFormats = ocrEngine.DocumentManager.GetAdditionalEngineFormats();

            if (installedEngineFormats.Length > 0 || additionalEngineFormats.Length > 0)
            {
                foreach (string format in installedEngineFormats)
                {
                    _lbInstalledEngineFormats.Items.Add(format);
                }

                foreach (string format in additionalEngineFormats)
                {
                    _lbAdditionalEngineFormats.Items.Add(format);
                }
            }
            else
            {
                _tabMain.TabPages.Remove(_tpEngineFormats);
            }
        }