Beispiel #1
0
        private async void IdSearch_OnClick(object sender, RoutedEventArgs e)
        {
            baselayer.Clear();
            aMapControl.HideInfoWindow();

            string id = "B000A07060";


            AMapPOIResults results = await AMapPOISearch.POIID(id);

            if (results.Erro == null)
            {
                if (results.POIList == null || results.POIList.Count == 0)
                {
                    Debug.WriteLine("无查询结果");
                    return;
                }

                foreach (AMapPOI item in results.POIList)
                {
                    var icon = new AMapIcon {
                        Location = new LngLat(item.Location.Lon, item.Location.Lat)
                    };

                    icon.Tapped += icon_Tapped;

                    icon.Data = item.Address;

                    await baselayer.Add(icon);
                }

                aMapControl.TrySetViewAsync(
                    new LngLat(results.POIList[0].Location.Lon, results.POIList[0].Location.Lat), null, null, null,
                    AMapAnimationKind.Default);
            }
            else
            {
                Debug.WriteLine(results.Erro.Message);
            }
        }
 private void aMapControl_Holding(AMapControl sender, AMapInputEventArgs args)
 {
     aMapControl.HideInfoWindow();
 }