+ Reply to Thread
Results 1 to 2 of 2

Thread: How to rescale an image in a Background task ?

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    25

    How to geolocalize your users ?

    I want to get the geolocation of windows 8 device. Please provide a sample code.
    Last edited by VamsyR; 05-08-2013 at 11:11 AM.

  2. #2
    Following example work fine for me. Class Geolocator helps windows 8 device to find geolocation of users device.

    // First declare geolocator instance.
    Code:
    var geolocator = new Geolocator();
    geolocator.PositionChanged += geolocator_PositionChanged;
    geolocator.GetGeopositionAsync();
    // Second write position change method.
    Code:
    void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
    {
        var position = args.Position;
        string pos = string.Format("Country:{0} Latitude: {1} Longitude: {2}",
                                             position.CivicAddress.Country,
                                             position.Coordinate.Latitude,
                                             position.Coordinate.Longitude);
    
         var action = new Action(() => tb.Text = pos);
         InvokedHandler handler = (s, ia) => action();
         Dispatcher.InvokeAsync(CoreDispatcherPriority.Normal, handler, this, null);
    }
    //Third, Don't forget to add following capability in manifest file.
    Click image for larger version

Name:	01.png
Views:	0
Size:	61.2 KB
ID:	240
    Last edited by AustinG; 05-08-2013 at 11:20 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts