36 lines
599 B
C#
36 lines
599 B
C#
using System.Threading.Tasks;
|
|
using SnippingTool;
|
|
using OcrClient.Services;
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
internal class OcrTool : ITool
|
|
{
|
|
private IOcrClient client = RhSolutionsAddIn.ServiceProvider.GetService<IOcrClient>();
|
|
|
|
public 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;
|
|
}
|
|
}
|
|
public void Dispose()
|
|
{
|
|
}
|
|
} |