using System.Threading.Tasks; using SnippingTool; using OcrClient.Services; namespace RhSolutions.Tools; internal class OcrTool : Tool { public Application Application { get; set; } private IOcrClient client = RhSolutionsAddIn.ServiceProvider.GetService(); public OcrTool(ReaderFactory readerFactory, WriterFactory writerFactory) : base(readerFactory, writerFactory) { } public override void Execute() { try { RhSolutionsAddIn.Excel.Visible = false; Task.Run(async delegate { await Task.Delay(250); }).Wait(); string shot = Snipper.SnipBase64(); var result = client.ProcessImage(shot); } catch (Exception) { throw; } finally { RhSolutionsAddIn.Excel.Visible = true; } } }