Exemplo n.º 1
0
        /// <summary>
        /// 矩形区域搜索
        /// </summary>
        /// <param name="searchName"></param>
        void _bQuickSearchControl_QuickSearch(string searchName)
        {
            LatLngPoint leftbottom = new LatLngPoint(_b_bound.LeftTop.Lng, _b_bound.RightBottom.Lat);
            LatLngPoint righttop = new LatLngPoint(_b_bound.RightBottom.Lng, _b_bound.LeftTop.Lat);
            ((Action)delegate()
            {
                PlaceService ps = new PlaceService();
                JObject places = ps.SearchInBound(searchName, leftbottom.Lat + "," + leftbottom.Lng + "," + righttop.Lat + "," + righttop.Lng);//区域搜索
                this.Invoke((Action)delegate()
                {
                    if (BPlacesBoard != null)
                    {
                        BPlacesBoard.AddPlaces(places["results"]);  //具体json格式参见api文档
                    }
                });

            }).BeginInvoke(null, null);
            _bQuickSearchControl.Visible = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 周边搜索
        /// </summary>
        /// <param name="query"></param>
        /// <param name="center"></param>
        void _bTipControl_SearchNearbyStarted(string query, LatLngPoint center)
        {
            ((Action)delegate()
            {
                PlaceService ps = new PlaceService();
                JObject places = ps.SearchInCircle(query, center.Lat + "," + center.Lng, 5000); //默认周边5km
                this.Invoke((Action)delegate()
                {
                    if (BPlacesBoard != null)
                    {
                        BPlacesBoard.AddPlaces(places["results"]);  //具体json格式参见api文档
                    }
                });

            }).BeginInvoke(null, null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 开始发起搜索
 /// </summary>
 public void StartSearch()
 {
     if (txtInput.Text != "")
     {
         ((Action)delegate()
         {
             PlaceService ps = new PlaceService();
             JObject places = ps.SearchInCity(_district +  txtInput.Text, _city == "" ? CurrentCity : _city);
             if (places != null)
             {
                 this.Invoke((Action)delegate()
                 {
                     if (BPlacesBoard != null)  //通知与之关联的位置列表控件
                     {
                         BPlacesBoard.AddPlaces(places["results"]);
                     }
                 });
             }
         }).BeginInvoke(null, null);
     }
 }