public static async Task<IDictionary<Layer, IEnumerable<IdentifyFeature>>> Identify(MapViewController controller, Point tapPoint, MapPoint mapPoint, IEnumerable<Layer> layers = null, double toleranceInPixels = 5)
{
if (controller == null)
throw new ArgumentNullException("controller");
if (layers == null)
throw new ArgumentNullException("layers");
var identifyLayers = LayerCollection.EnumerateLeaves(layers);
var results = await Task.WhenAll((from l in identifyLayers where l.IsVisible select IdentifyLayer(controller, l, tapPoint, mapPoint)).Where((l => l != null)).ToArray()).ConfigureAwait(false);
IDictionary<Layer, IEnumerable<IdentifyFeature>> taskResults = null;
foreach (var result in results)
{
if (taskResults == null)
taskResults = new Dictionary<Layer, IEnumerable<IdentifyFeature>>();
if (!taskResults.ContainsKey(result.Key))
taskResults.Add(result);
}
return taskResults;
}