Ejemplo n.º 1
0
        /* Adjust Doctor Location on the Map */
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            var locator = new Geolocator();

            locator.DesiredAccuracyInMeters = 50;

            var position = await locator.GetGeopositionAsync();

            var docPosition = new BasicGeoposition();

            docPosition.Latitude  = db.getDoctorInfo(GetDoctor().doctor_name)[0].latitude;
            docPosition.Longitude = db.getDoctorInfo(GetDoctor().doctor_name)[0].longitude;

            var myPoint = new Geopoint(docPosition);

            if (await DocLocation.TrySetViewAsync(myPoint, 10D))
            {
            }

            DocLocation.ZoomLevel = 16;

            var gl = new Geolocator()
            {
                DesiredAccuracy = PositionAccuracy.High
            };
            var location = await gl.GetGeopositionAsync(TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5));

            var pin = new MapIcon()
            {
                Location = myPoint,
                Title    = db.getDoctorInfo(GetDoctor().doctor_name)[0].hospital_name,
                Image    = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Pictures/pin.png")),
                NormalizedAnchorPoint = new Point()
                {
                    X = 0.32, Y = 0.78
                },
            };

            DocLocation.MapElements.Add(pin);
        }