private void btnSearch_Click(object sender, EventArgs e) { string location = txtName.Text.Trim(); if (string.IsNullOrEmpty(location)) { return; } ListGeoCoords.BeginUpdate(); fMapBrowser.BeginUpdate(); try { IList <GeoPoint> searchPoints = new List <GeoPoint>(); AppHost.Instance.RequestGeoCoords(location, searchPoints); ListGeoCoords.Items.Clear(); fMapBrowser.ClearPoints(); int num = searchPoints.Count; for (int i = 0; i < num; i++) { GeoPoint pt = searchPoints[i]; GKListItem item = new GKListItem(pt.Hint, pt); item.AddSubItem(PlacesLoader.CoordToStr(pt.Latitude)); item.AddSubItem(PlacesLoader.CoordToStr(pt.Longitude)); ListGeoCoords.Items.Add(item); fMapBrowser.AddPoint(pt.Latitude, pt.Longitude, pt.Hint); if (i == 0) { fMapBrowser.SetCenter(pt.Latitude, pt.Longitude, -1); } } //this.fMapBrowser.ZoomToBounds(); } finally { fMapBrowser.EndUpdate(); ListGeoCoords.EndUpdate(); } }
private void TreePlaces_DoubleClick(object sender, EventArgs e) { GKTreeNode node = tvPlaces.SelectedItem as GKTreeNode; if (node == null) { return; } GeoPoint pt = node.Tag as GeoPoint; if (pt == null) { return; } fMapBrowser.SetCenter(pt.Latitude, pt.Longitude, -1); }