From 571a5fd706dba7729299f02de3935a55a4179125 Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Mon, 16 Dec 2024 18:05:43 +0300 Subject: [PATCH] Show no tables found infobox --- RhSolutions.AddIn/Tools/OcrTool.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RhSolutions.AddIn/Tools/OcrTool.cs b/RhSolutions.AddIn/Tools/OcrTool.cs index ae460ca..e2d8ffb 100644 --- a/RhSolutions.AddIn/Tools/OcrTool.cs +++ b/RhSolutions.AddIn/Tools/OcrTool.cs @@ -28,7 +28,7 @@ internal class OcrTool : ITool if (shot != null) { IEnumerable tables = await client.ProcessImage(shot); - if (tables != null) + if (tables.Count() != 0) { foreach (var table in tables) { @@ -70,6 +70,15 @@ internal class OcrTool : ITool app.ActiveSheet.Cells(currentCell.Row + rowCount + 1, currentCell.Column).Activate(); } } + else + { + MessageBox.Show(@"В выделенном фрагменте не распознано ни одной таблицы.", + "Ошибка", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + RhSolutionsAddIn.Excel.Visible = true; + return; + } } } catch (Exception)