Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 轻触wp8中的地点标记时显示地点名称_C#_Windows Phone 8 - Fatal编程技术网

C# 轻触wp8中的地点标记时显示地点名称

C# 轻触wp8中的地点标记时显示地点名称,c#,windows-phone-8,C#,Windows Phone 8,我正试图用google places API在window phone 8地图控件上显示距离我当前位置1公里以内的地方。我正在使用JSON解析获取纬度、经度和名称。现在,我希望在用户点击任意位置圆时,该名称像工具提示一样显示 //使用GoogleAPI显示POI HttpClient client = new HttpClient(); string baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?l

我正试图用google places API在window phone 8地图控件上显示距离我当前位置1公里以内的地方。我正在使用JSON解析获取纬度、经度和名称。现在,我希望在用户点击任意位置圆时,该名称像工具提示一样显示

//使用GoogleAPI显示POI

HttpClient client = new HttpClient();
string baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + position.Coordinate.Latitude + "," + position.Coordinate.Longitude + "&radius=1000&keyword=hospital&key=AIzaSyBCccOYAea2ITvgqNpIHcutuExQwzQctCk";
string googleResult = await client.GetStringAsync(baseUrl);
//解析JSON数据

JObject obj = JObject.Parse(googleResult);
JArray jarr = (JArray)obj["results"];

foreach(var item in jarr)
        {
            string name = (string)item.SelectToken("name");
            double lt = (double)item.SelectToken("geometry.location.lat");
            double lg = (double)item.SelectToken("geometry.location.lng");

            //Create a small circle to mark the current location.
            Ellipse myCircle2 = new Ellipse();
            myCircle2.Fill = new SolidColorBrush(Colors.Red);
            myCircle2.Height = 10;
            myCircle2.Width = 10;
            myCircle2.Opacity = 50;

            // Create a MapOverlay to contain the circle.
            MapOverlay myLocationOverlay2 = new MapOverlay();
            myLocationOverlay2.Content = myCircle2;
            myLocationOverlay2.PositionOrigin = new Point(0.5, 0.5);
            GeoCoordinate myGeoCoordinate2 = new GeoCoordinate(lt, lg);
            myLocationOverlay2.GeoCoordinate = myGeoCoordinate2;

            // Create a MapLayer to contain the MapOverlay.
            MapLayer myLocationLayer2 = new MapLayer();
            myLocationLayer2.Add(myLocationOverlay2);

            // Add the MapLayer to the Map.
            Bmap.Layers.Add(myLocationLayer2);

        }