Note that there are some explanatory texts on larger screens.

plurals
  1. POPositionChanged & StatusChanged event getting fired twice in WP7
    primarykey
    data
    text
    <p>I am trying to getting coordinates with the help of GPS and when i am putting a dry run or debug the event makes PositionChange &amp; StatusChange to call TWICE. Here is my code please help me.</p> <pre><code> private void button1_Click(object sender, RoutedEventArgs e) { if (NetworkInterface.GetIsNetworkAvailable()) { flag = true; if (watcher == null) { watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default); watcher.MovementThreshold = 20; watcher.PositionChanged += new EventHandler&lt;GeoPositionChangedEventArgs&lt;GeoCoordinate&gt;&gt;(watcher_PositionChanged); watcher.StatusChanged += new EventHandler&lt;GeoPositionStatusChangedEventArgs&gt;(watcher_StatusChanged); watcher.Start(); } } } void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: MessageBox.Show("Location Service is not enabled on the device"); break; case GeoPositionStatus.NoData: MessageBox.Show(" The Location Service is working, but it cannot get location data."); break; } } void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs&lt;GeoCoordinate&gt; e) { if (e.Position.Location.IsUnknown) { MessageBox.Show("Please wait while your prosition is determined...."); return; } List&lt;string&gt; locationData = new List&lt;string&gt;(); locationData.Add(e.Position.Location.Latitude.ToString("Latitude:" + "0.000")); locationData.Add(e.Position.Location.Longitude.ToString("Longitude:" + "0.000")); locationData.Add(e.Position.Location.Altitude.ToString()); locationData.Add(e.Position.Location.Speed.ToString()); locationData.Add(e.Position.Location.Course.ToString()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload