Exemplo n.º 1
0
 private void button6_Click(object sender, EventArgs e)
 {
     MapPoint.ApplicationClass mapPoint = new MapPoint.ApplicationClass();
     MapPoint.Map         map           = mapPoint.ActiveMap;
     MapPoint.FindResults findResults   = map.FindPlaceResults(this.textBox1.Text);
     var a = findResults[0];
 }
        private object GetLocation(string postCode)
        {
            if (postCode.StartsWith(">"))
            {
                postCode = postCode.Substring(1);
            }


            MapPoint.FindResults objRes = axMappointControl1.ActiveMap.FindAddressResults("", "", "", "", postCode, MapPoint.GeoCountry.geoCountryUnitedKingdom);


            MapPoint.Location loc = null;

            if (objRes.Count == 0)
            {
                var objCoord = new TaxiDataContext().Gen_Coordinates.FirstOrDefault(c => c.PostCode == postCode);

                if (objCoord != null)
                {
                    loc = axMappointControl1.ActiveMap.GetLocation(Convert.ToDouble(objCoord.Latitude), Convert.ToDouble(objCoord.Longitude), 1.00);
                }
            }
            else
            {
                object item = 1;
                loc = (MapPoint.Location)objRes.get_Item(ref item);
            }


            return((object)loc);
        }