I've tried several different approaches to getting the simple geoprocessing package that I created to execute from my C# project . . .
ESRI.ArcGIS.Client.Tasks.Geoprocessor _localGPService = null;
string gpkPath = ConfigurationManager.AppSettings["EsriRuntimeGeoPackageLocation"];
string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"];
LocalGeoprocessingService.GetServiceAsync(gpkPath, GPServiceType.Execute, (gpService) =>
{
if (gpService.Error != null)
{
MessageBox.Show(gpService.Error.Message);
}
_localGPService = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(gpService.UrlGeoprocessingService + geoObjectPath);
DataContext = this;
});
List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>();
_localGPService.ExecuteAsync(parameters);
I've also tried the following . . .
private LocalGeoprocessingService _localGPService = null;
string gpkPath = ConfigurationManager.AppSettings["EsriRuntimeGeoPackageLocation"];
_localGPService = new LocalGeoprocessingService(gpkPath, GPServiceType.Execute);
_localGPService.StartAsync((callback) =>
{
if (callback.Error == null)
{
CoverButton.IsEnabled = true;
}
else
{
MessageBox.Show("Error starting gp service");
}
});
string geoObjectPath = ConfigurationManager.AppSettings["EsriRuntimeGeoProcessorObject"];
ESRI.ArcGIS.Client.Tasks.Geoprocessor gp = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(_localGPService.UrlGeoprocessingService + geoObjectPath);
List<ESRI.ArcGIS.Client.Tasks.GPParameter> parameters = new List<ESRI.ArcGIS.Client.Tasks.GPParameter>();
gp.ExecuteAsync(parameters);
When it gets to the last line (execute), I don't get an error, but it also doesn't do anything. I've been tracing through the code, and the geoprocessor object does get created and invoked with a URL, so I don't know why it does nothing. Tracing through, it appears as if everything is OK. The tool that the gpk was created from runs OK when I execute it in ArcMap. There are no input or output parameters in the model (tool).
Any ideas as to what might cause this? I just don't know what to look for anymore. Thanks!