This is what I do// List of parameters
List<GPParameter> gpParameters = new List<GPParameter>();
gpParameters.Add(new GPString(input1, "input1Value"));
gpParameters.Add(new GPString(input2, "input2Value"));
// Call GP task
Geoprocessor gpTask = new Geoprocessor(gpTaskURL);
// Event raised if job failed
gpTask.Failed += (s1, e1) =>
{
// If failed
MessageBox.Show("Task failed");
};
// Event raised if job completed
gpTask.JobCompleted += (s2, e2) =>
{
Geoprocessor gp = s2 as Geoprocessor;
gp.GetResultDataCompleted += (s3, e3) =>
{
if (e3.Parameter is GPString)
{
// Do something to show in silverlight
}
else if (e3.Parameter is GPFeatureRecordSetLayer)
{
// Do something to show in silverlight
GPFeatureRecordSetLayer gpresultLayer = e3.Parameter as GPFeatureRecordSetLayer;
foreach (Graphic graphic in gpresultLayer.FeatureSet.Features)
{
}
}
};
// Get the result data
gp.GetResultDataAsync(e3.JobInfo.JobId, pythonScriptOutputParamterName);
};
// Submit GP task
gpTask.SubmitJobAsync(gpParameters);
When I write my python script I specify a parameter called pythonScriptOutputParamterName with a datatype with direction as "output" I specify the same name at gp.GetResultDataAsync