38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using ArcGIS.Desktop.Core.Geoprocessing;
|
|
using ArcGIS.Desktop.Framework.Dialogs;
|
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
|
|
|
namespace LinkToolAddin.server;
|
|
|
|
public class CallArcGISPro
|
|
{
|
|
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(CallArcGISPro));
|
|
|
|
public async static Task<JsonRpcResultEntity> CallArcGISProTool(string toolName, List<string> toolParams)
|
|
{
|
|
var results = await Geoprocessing.ExecuteToolAsync(toolName, toolParams);
|
|
JsonRpcResultEntity jsonRpcResultEntity;
|
|
if (results.ErrorCode == 0)
|
|
{
|
|
jsonRpcResultEntity = new JsonRpcErrorEntity()
|
|
{
|
|
Error = new Error()
|
|
{
|
|
Code = results.ErrorCode,
|
|
Message = results.ErrorMessages.ToString()
|
|
}
|
|
};
|
|
}
|
|
else
|
|
{
|
|
jsonRpcResultEntity = new JsonRpcSuccessEntity
|
|
{
|
|
Result = results.Messages.ToString()
|
|
};
|
|
}
|
|
return jsonRpcResultEntity;
|
|
}
|
|
} |