private async void OnMapTapped(object obj)
{
if (obj == null || IsMeasureOpened)
return;
if (obj is MapViewInputEventArgs)
{
var e = (MapViewInputEventArgs)obj;
var graphics = await Controller.GraphicsLayerHitTestAsync(_searchResultLayer, e.Position, 10);
// get the first grapghic hit whose symbol is of type PictureMarkerSymbol
var hit = (from g in graphics where g.Symbol is PictureMarkerSymbol select g).FirstOrDefault();
if (hit != null)
{
var id = (int)hit.Attributes["ID"];
if (id - 1 < Locations.Count)
SearchResultSelectedItem = Locations[id - 1];
}
else // Identify
{
try
{
await Identify(e.Position, e.Location, OperationalLayers);
}
catch (Exception ex)
{
#if DEBUG
System.Diagnostics.Debug.WriteLine(ex.Message);
#endif
}
}
}
}