private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
{
Geoprocessor geoprocessorTask = sender as Geoprocessor;
geoprocessorTask.GetResultDataCompleted += (s1, ev1) =>
{
GraphicsLayer graphicsLayer = MyMap.Layers["MyResultGraphicsLayer"] as GraphicsLayer;
if (ev1.Parameter is GPFeatureRecordSetLayer)
{
GPFeatureRecordSetLayer gpLayer = ev1.Parameter as GPFeatureRecordSetLayer;
if (gpLayer.FeatureSet.Features.Count == 0)
{
geoprocessorTask.GetResultImageLayerCompleted += (s2, ev2) =>
{
GPResultImageLayer gpImageLayer = ev2.GPResultImageLayer;
gpImageLayer.Opacity = 0.5;
MyMap.Layers.Add(gpImageLayer);
ProcessingTextBlock.Text = "Greater than 500 features returned. Results drawn using map service.";
_processingTimer.Stop();
};
geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Clipped_Counties");
return;
}
foreach (Graphic graphic in gpLayer.FeatureSet.Features)
{
graphic.Symbol = LayoutRoot.Resources["ClipFeaturesFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
graphicsLayer.Graphics.Add(graphic);
}
}
processingGrid.Visibility = Visibility.Collapsed;
_processingTimer.Stop();
};
geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Clipped_Counties");
}