LocalGeometryService.GetServiceAsync(localGeometryService =>
{
// Create a new GeometryService task instance.
geometryTask = new GeometryService();
// Set the Url property to the Url of the LocalGeometryService.
geometryTask.Url = localGeometryService.UrlGeometryService;
// Register event handlers for the BufferCompleted and Failed events.
geometryTask.UnionCompleted += GeometryService_UnionCompleted;
geometryTask.Failed += GeometryService_Failed;
});
//after query and got all the features
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
selectedGraphics = featureSet.Features as List<Graphic>;
//start union
geometryTask.UnionAsync(selectedGraphics);
}