简体   繁体   中英

Event for Geolocation Changed in Windows Phone 8

Is there any event for the geolocation changed in Windows Phone 8 (C#)?
I want to trigger some event when the geolocation is changed like city from reversegeocoding changed. If not, then is it possible to call some event manually whenever the Phone's location like City is Changed. (suppose I have fetched the city using reverse geocoding). (for Windows Phone 8)

I can't understand your question properly, But this answer may solve your problem.

There is a event called "PositionChanged" in geolocator. This event gets triggered when geolocator position is changed.

 geolocator = new Geolocator();
 geolocator.PositionChanged -= geolocator_PositionChanged;

void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
    Dispatcher.BeginInvoke(() =>
    {
        LatitudeTextBlock.Text = args.Position.Coordinate.Latitude.ToString("0.00");
        LongitudeTextBlock.Text = args.Position.Coordinate.Longitude.ToString("0.00");
    });
}

for more info ::: http://msdn.microsoft.com/en-us/library/windows/apps/jj247548(v=vs.105).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM