private async void ProcessOcrImage(Image image) { var lang = (string)mnuLanguageCombo.SelectedItem; var imageFormat = (string)mnuFormatImageCombo.SelectedItem; var result = await OCR.Process(image, (OcrLanguages)Enum.Parse(typeof(OcrLanguages), lang), (FormatImageCognitiveService)Enum.Parse(typeof(FormatImageCognitiveService), imageFormat)); notifyIcon.Visible = true; if (this.mnuVisualizeResult.Checked) { OcrResultForm.ShowOcr(result); } }
public static void ShowOcr(ResultOCR result) { var form = new OcrResultForm(); if (!result.Success) { form.txtLog.Text = $"ERROR: {result.Error}"; form.txtLog.ForeColor = Color.Red; } else { form.txtLog.Text = result.Text.Replace("\n", Environment.NewLine); form.txtLog.ForeColor = SystemColors.WindowText; } form.txtLog.Select(0, 0); form.Show(); }