Playing with Geo Coordinates in visual studio

So, here we will be discussing how you can create your own application that gives you your location. In order to implement Geo coordinate in your application we need to same steps we used to do in order to implement our things that is: opening a visual studio and create empty blank app for windows phone in silver light.

So, lets go with it open a visual studio and create windows phone silver light blank app and add two buttons with text block in it which will show you the location of yours. So, i have opened my visual studio and place controls in it like i told you above, follow the following steps in order to get Geo coordinates of your location.

  1. place a on-click event in one of your button and name your button as Locate me.
  2. on its click event create a GeoCoordinateWatcher object and name it as geo.
  3. In order to play with start the process with go to mainpage.xaml.cs and add the following method.
    <br /> private void Locate_Click(object sender, EventArgs e)<br /> {<br /> GeoCoordinateWatcher ge = new GeoCoordinateWatcher(GeoPositionAccuracy.High);<br /> ge.Start();<br /> if (!ge.Position.Location.IsUnknown)<br /> {<br /> abc.Text = ge.Position.Location.Latitude.ToString() + "," + ge.Position.Location.Longitude.ToString();<br /> }<br /> else<br /> abc.Text = "unable to find your location";<br /> }<br />

  4. So when you run the application you will see location in the very textblock named as abc on very button click.


So, in order to get your application use you location you can simply use the above mentioned method in your application’s  button in order to achieve something with your application. With this Geo-coordinate-watcher’s object you can simply use your location for different purposes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s