Exemplo n.º 1
0
        public Page1()
        {
            InitializeComponent();
            //testLong = finalLocation.ToString();

            CustomMap customMap = new CustomMap
            {
                MapType = MapType.Street
            };
            //testLat = positionTest.Latitude.ToString();
            //testLong = positionTest.Longitude.ToString();
            //Location positionTest = getPositionAsync(testAddress1).Result;
            CustomPin testPin = new CustomPin
            {
                Type = PinType.Place,
                //Position = positionTest.Result,
                //Position = new Position(positionTest.Latitude, positionTest.Longitude),
                //Position = new Position(40.7712, -111.9002),
                Position = new Position(finalLocation.Latitude, finalLocation.Longitude),
                Label    = "Latitude: " + testLat + " Longitude: " + testLong
            };

            customMap.MoveToRegion(MapSpan.FromCenterAndRadius(startPosition, Distance.FromMiles(0.1)));
            Content = customMap;
            customMap.Pins.Add(testPin);
            getPositionAsync(testAddress1);
        }
Exemplo n.º 2
0
        public async Task <Location> getPositionAsync(string markerAdress)
        {
            Location finalLocation = new Location();
            Geocoder coder         = new Geocoder();

            try
            {
                var markerLocation = await Geocoding.GetLocationsAsync(markerAdress);

                var markerLongLat = markerLocation.FirstOrDefault();
                //var markerLocation = await coder.GetPositionsForAddressAsync(markerAdress);

                if (markerLongLat != null)
                {
                    finalLocation.Latitude  = markerLongLat.Latitude;
                    finalLocation.Longitude = markerLongLat.Longitude;

                    Position startPosition = new Position(40.7712, -111.9002);

                    CustomMap customMap = new CustomMap
                    {
                        MapType = MapType.Street
                    };

                    customMap.MoveToRegion(MapSpan.FromCenterAndRadius(startPosition, Distance.FromMiles(0.1)));
                    Content = customMap;
                    CustomPin testPin = new CustomPin
                    {
                        Type = PinType.Place,
                        //Position = positionTest.Result,
                        Position = new Position(finalLocation.Latitude, finalLocation.Longitude),
                        //Position = new Position(40.7712, -111.9002),
                        Label = "LDSBC"
                    };

                    //return finalLocation;
                    customMap.Pins.Add(testPin);
                }
            }
            catch (Exception ex)
            {
            }
            return(finalLocation);
        }
Exemplo n.º 3
0
        public static async Task <Page2> CreateAsync()
        {
            var pg2 = new Page2();



            //Location locationTest = await pg2.getPositionAsync(testAddress1);



            CustomPin testPin = new CustomPin
            {
                Type = PinType.Place,
                //Position = positionTest.Result,
                //Position = new Position(locationTest.Latitude, locationTest.Longitude),
                //Position = new Position(40.7712, -111.9002),
                Label = "LDSBC"
            };

            //customMap.Pins.Add(testPin);
            //pg2.Content = customMap;

            return(pg2);
        }