protected override void toolStripButtonSpellCheck_Click(object sender, EventArgs e) { string localeId = null; if (LookupISO_3_1_Codes.ContainsKey(curLangCode)) { localeId = LookupISO_3_1_Codes[curLangCode]; } else if (LookupISO_3_1_Codes.ContainsKey(curLangCode.Substring(0, 3))) { localeId = LookupISO_3_1_Codes[curLangCode.Substring(0, 3)]; } if (localeId == null) { MessageBox.Show("Need to add an entry in Data/ISO639-1.xml file."); return; } speller = new SpellCheckHelper(this.textBox1, localeId); if (this.toolStripButtonSpellCheck.Checked) { speller.EnableSpellCheck(); } else { speller.DisableSpellCheck(); } this.textBox1.Refresh(); }
protected override void buttonSpellcheck_Click(object sender, RoutedEventArgs e) { string localeId = null; if (LookupISO_3_1_Codes.ContainsKey(curLangCode)) { localeId = LookupISO_3_1_Codes[curLangCode]; } else if (LookupISO_3_1_Codes.ContainsKey(curLangCode.Substring(0, 3))) { localeId = LookupISO_3_1_Codes[curLangCode.Substring(0, 3)]; } if (localeId == null) { MessageBox.Show("Need to add an entry in Data/ISO639-1.xml file.", Gui.strProgName, MessageBoxButton.OK, MessageBoxImage.Information); return; } speller = new SpellCheckHelper(this.textBox1, localeId); if (this.buttonSpellcheck.IsChecked.Value) { try { speller.EnableSpellCheck(); } catch (Exception ex) { MessageBox.Show(ex.Message, Gui.strProgName, MessageBoxButton.OK, MessageBoxImage.Error); } } else { speller.DisableSpellCheck(); } }
private void buttonDownload_Click(object sender, RoutedEventArgs e) { if (this.listBox.SelectedIndex == -1) { return; } bool isWriteAccess = CheckDirectoryWriteAccess(Path.Combine(baseDir, TESS_DATA)); if (!isWriteAccess) { string msg = String.Format(Properties.Resources.Access_denied, Path.Combine(baseDir, TESS_DATA).ToString()); MessageBox.Show(msg, Gui.strProgName, MessageBoxButton.OK, MessageBoxImage.Warning); return; } this.buttonDownload.IsEnabled = false; this.buttonCancel.IsEnabled = true; this.toolStripProgressBar1.Value = 0; this.toolStripProgressBar1.Visibility = Visibility.Visible; this.buttonDownload.IsEnabled = false; this.toolStripStatusLabel1.Content = Properties.Resources.Downloading; this.Cursor = Cursors.Wait; clients.Clear(); downloadTracker.Clear(); contentLength = 0; numOfConcurrentTasks = this.listBox.SelectedItems.Count; foreach (ListBoxItem item in this.listBox.SelectedItems) { string key = FindKey(LookupISO639, item.Content.ToString()); // Vietnamese -> vie if (key != null) { try { Uri uri = new Uri(availableLanguageCodes[key]); DownloadDataFile(uri, TESS_DATA); // download language data pack. In Tesseract 3.02, data is packaged under tesseract-ocr/tessdata directory if (LookupISO_3_1_Codes.ContainsKey(key)) { string iso_3_1_Code = LookupISO_3_1_Codes[key]; // vie -> vi_VN if (availableDictionaries.ContainsKey(iso_3_1_Code)) { uri = new Uri(availableDictionaries[iso_3_1_Code]); ++numOfConcurrentTasks; DownloadDataFile(uri, DICTIONARY_FOLDER); // download dictionary } } } catch (Exception) { if (--numOfConcurrentTasks <= 0) { this.toolStripStatusLabel1.Content = Properties.Resources.Downloaderror; this.toolStripProgressBar1.Visibility = Visibility.Hidden; resetUI(); } } } } }