Geoprocessor Tasks

2747
4
11-04-2015 11:07 AM
ChristinaKochan1
Occasional Contributor

In the WPF Runtime, we had a geoprocessing tool that allowed the user to load their own custom geoprocessing packages. We create the geoprocessor basically as follows:

_service = await LocalGeoprocessingService.StartAsync(definition.Path, GeoprocessingServiceType.SubmitJobWithMapServerResult, 30000);

var firstTask = _service.Tasks.FirstOrDefault();

_geoprocessor = new Geoprocessor(new Uri(_service.UrlGeoprocessingService + "/" + firstTask.DisplayName));

Now in the Runtime for .NET the Tasks collection is not available. We will never have the ability to hard code the task name like the examples all show. Is there any way to dynamically get the Task names from the server without having to scrape the html page or do something similarly obnoxious?

Thanks

0 Kudos
4 Replies
FreddieGibson
Occasional Contributor III

Have you tried the following?

// Create a new LocalGeoprocessing service of synchronous execution type.
LocalGeoprocessingService gpService
  = new LocalGeoprocessingService("Path to geoprocessing package", GPServiceType.Execute, 1000000);

gpService.StartAsync(delegateService =>
  {
   // Instantiate a new Geoprocessor task with the Url.
  ESRI.ArcGIS.Client.Tasks.Geoprocessor geoprocessorTask
  = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(gpService.Tasks[0].Url);
  });
0 Kudos
ChristinaKochan1
Occasional Contributor

That is how we used to get Tasks, but now in 10.2.6 the problem is that the Tasks collection no longer exists on the LocalGeoprocessingService. Your examples show to use the Tasks collection, but if you look at the Properties of LocalGeoprocessingService, Tasks does not exist. The property cannot be resolved.

LocalGeoprocessingService Class

0 Kudos
FreddieGibson
Occasional Contributor III

I noticed the same thing yesterday, but I didn't get a chance to test it. I pulled the snippet I posted from the sample at the bottom of the following page:

Local Geoprocessing Service Class

https://developers.arcgis.com/net/desktop/api-reference//html/T_Esri_ArcGISRuntime_LocalServices_Loc...

I just confirmed with development that the code shown at the bottom of the page isn't valid for .Net and we're putting in a request to get that corrected. I'll have to look a bit deeper into this to see if there is another avenue available to accomplish this.

0 Kudos
ChristinaKochan1
Occasional Contributor

Thank you. Do you happen to know why the property was removed in .NET?

0 Kudos