private void WatcherOnPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            try
            {
                if (DateTime.Now.TimeOfDay.Subtract(_lastTimeSend) >= _minSendTime)
                {
                    _geozoneRequest.Lat = e.Position.Location.Latitude;
                    _geozoneRequest.Lon = e.Position.Location.Longitude;

                    WebClient webClient = new WebClient();
                    webClient.UploadStringCompleted += (o, args) =>
                                                           {
                                                                   if (args.Error == null)
                                                                   {
                                                                       JObject jRoot = JObject.Parse(args.Result);

                                                                       if (JsonHelpers.GetStatusCode(jRoot) == 200)
                                                                       {
                                                                           double dist = jRoot["response"].Value<double>("distance");
                                                                           if (dist > 0)
                                                                               LazyWatcher.MovementThreshold = dist / 2;
                                                                       }
                                                                   }
                                                           };
                    string request = string.Format("{{\"request\":{0}}}", JsonConvert.SerializeObject(_geozoneRequest));
                    webClient.UploadStringAsync(Constants.GeozoneUrl, request);

                    _lastTimeSend = DateTime.Now.TimeOfDay;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error when handling position change: " + ex.ToString());
            }
        }
Example #2
0
        private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            Logger.Log(String.Format("Position changed: Unknown: {2}, Lat: {0}, Long: {1}", e.Position.Location.Latitude.ToString(), e.Position.Location.Longitude.ToString(), e.Position.Location.IsUnknown));
            this.currentGeoLocation = e.Position.Location;

            OnNewLocationAvailable();
        }
Example #3
0
        private void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if (e.Position.Location.IsUnknown == true)
            {
                //OnNewGPoint(this, new GPointEventArgs(new GPoint(0, 0, 0)));
            }
            else
            {
                GPoint newPoint = MakeGPointFromGeoCoordinatePostion(e.Position);
                if (lastPoint != null)
                {
                    Double distanceFromLastPoint = this.CalculateDistanceBetweenTwoGPoint(lastPoint, newPoint);
                    if (lastPoint.IsEqual(newPoint, true, gSystemSettings.ComparingPointSeconds))
                    {
                        return;//It's the same location  - this is not a new point
                    }

                    if (distanceFromLastPoint < gSystemSettings.DistanceInMeters)
                    {
                        return; //It's in the same spot
                    }
                }
                lastPoint = newPoint;
                OnNewGPoint(this, new GPointEventArgs(newPoint));
            }
            System.Diagnostics.Debug.WriteLine(e.Position.Location.Longitude + " " + e.Position.Location.Latitude + " H:" + e.Position.Location.HorizontalAccuracy.ToString() + " V:" + e.Position.Location.VerticalAccuracy.ToString());
        }
Example #4
0
 private void watcher_PositionChanged(object sender, 
                 GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     var location = e.Position.Location;
     var lat = location.Latitude;
     var lon = location.Longitude;
 }
Example #5
0
        private void Geowach_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            map.Layers.Clear();

            Ellipse myCircle = new Ellipse();

            myCircle.Fill    = new SolidColorBrush(Colors.Blue);
            myCircle.Height  = 20;
            myCircle.Width   = 20;
            myCircle.Opacity = 50;

            MapOverlay myLocationOverlay = new MapOverlay();

            myLocationOverlay.Content        = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate  = e.Position.Location;

            Microsoft.Phone.Maps.Controls.MapLayer myLocationLayer = new Microsoft.Phone.Maps.Controls.MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            map.Layers.Add(myLocationLayer);
            map.Center = e.Position.Location;
            map.SetView(e.Position.Location, 18, MapAnimationKind.Linear);

            //map.SetView(e.Position.Location, 18);
        }
Example #6
0
        private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if ((bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"] == true)
            {
                var coord = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

                if (_line.Path.Count > 0)
                {
                    // find the previos point and measure the distance travelled
                    var previousPoint = _line.Path.Last();
                    var distance      = coord.GetDistanceTo(previousPoint);

                    // compute pace
                    var millisPerKilometer = (1000.0 / distance) * (System.Environment.TickCount - _previousPositionChangeTick);

                    // compute total distance travelled
                    _kilometres += distance / 1000.0;

                    paceLabel.Text     = TimeSpan.FromMilliseconds(millisPerKilometer).ToString(@"mm\:ss");
                    distanceLabel.Text = string.Format("{0:f2} km", _kilometres);
                    caloriesLabel.Text = string.Format("{0:f0}", _kilometres * 65);
                }

                _line.Path.Add(coord);
            }
        }
Example #7
0
        private void wtc_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            var gpsdata = e.Position.Location;

            Latitude  = gpsdata.Latitude;
            Longitude = gpsdata.Longitude;
            Speed     = gpsdata.Speed;
            if (double.IsNaN(Speed) == false)//キューの長さを常に10に保つ。
            {
                speedRecorder_forCalcAvgSpeed.Enqueue(Speed);
                if (speedRecorder_forCalcAvgSpeed.Count == 10)
                {
                    speedRecorder_forCalcAvgSpeed.Dequeue();
                }
            }

            Course             = gpsdata.Course;
            Altitude           = gpsdata.Altitude;
            HorizontalAccuracy = gpsdata.HorizontalAccuracy;
            VerticalAccuracy   = gpsdata.VerticalAccuracy;
            AvgSpeed           = calcAvgSpeed();
            IsLocationUnknown  = gpsdata.IsUnknown;
            //System.Diagnostics.Debug.WriteLine(Speed);

            GPSDataChangedEventArgs changedEvent = new GPSDataChangedEventArgs();

            OnGPSDataChanged(changedEvent);//イベントを発行する。
        }
Example #8
0
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            if (e.Position.Location.IsUnknown)
            {
                MessageBox.Show("Please wait while your prosition is determined....");
                return;
            }

            this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

            if (this.map.Children.Count != 0)
            {
                var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));

                if (pushpin != null)
                {
                    this.map.Children.Remove(pushpin);
                    
                }
            }

            Pushpin locationPushpin = new Pushpin();
            locationPushpin.Background = new SolidColorBrush(Colors.Purple);
            locationPushpin.Content = "You are here";
            locationPushpin.Tag = "locationPushpin";
            locationPushpin.Location = watcher.Position.Location;
            this.map.Children.Add(locationPushpin);
            this.map.SetView(watcher.Position.Location, 10.0);
            locationPushpin.Location = new GeoCoordinate(8.570515, 8.308844);
        }
Example #9
0
 //What to do if position change is tracked.
 private void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     TrackPosition(e);
     GetKilometres();
     GetCalories();
     GetMoney();
 }
Example #10
0
 void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
     {
         tb_Latitude.Text = e.Position.Location.Latitude.ToString();
         tb_Longitude.Text = e.Position.Location.Longitude.ToString();
 
 
 }
Example #11
0
 /// <summary>
 /// When GPS position changes requery for new speed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (NetworkInterface.GetIsNetworkAvailable())
     {
         if (App._watcher != null)
         {
             Debug.WriteLine("change position !!!");
             Debug.WriteLine("Speed is !!! " + App._watcher.Speed.ToString());
             if (App._watcher.Speed.ToString().Contains("NaN"))
             {
                 txt_speed.Text = "0";
                 speed          = 0;
             }
             else
             {
                 speed = App._watcher.Speed;
                 if (((string)App._settings["unit"]).Equals("us"))
                 {
                     txt_speed.Text = App._watcher.SpeedMilesPerHour.ToString();
                     txt_unit.Text  = "miles / hour";
                 }
                 else
                 {
                     txt_speed.Text = App._watcher.SpeedKilometersPerHour.ToString();
                     txt_unit.Text  = "km / hour";
                 }
             }
         }
     }
 }
 void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     latitudeTextBlock.Text = e.Position.Location.Latitude.ToString("0.000");
     longitudeTextBlock.Text = e.Position.Location.Longitude.ToString("0.000");
     MyMap.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
     MyMap.ZoomLevel = 5;
 }
        void MyPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            // Update the TextBlocks to show the current location
            //textBlock4.Text = e.Position.Location.Latitude.ToString("0.000000000");
            //textBlock5.Text = e.Position.Location.Longitude.ToString("0.000000000");
            map1.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
            pin1.Location = e.Position.Location;
            map1.SetView(pin1.Location, 18);

            //textBox4.Text = e.Position.Location.VerticalAccuracy.ToString();

            if (e.Position.Location.HorizontalAccuracy < 30 && e.Position.Location.VerticalAccuracy < 30)
            {
                textBlock3.Text = "GPS Locked, Press Start to Begin";
                locked = true;
            }
            else
            {
                if (locked==false)
                textBlock3.Text = "Please Wait, GPS Locking";
            }

            if (start == true)
            {
                _joggingPolyLine.Locations.Add(new Location() { Latitude = e.Position.Location.Latitude, Longitude = e.Position.Location.Longitude });
                path = path + var;
                if (speed < e.Position.Location.Speed)
                    speed = e.Position.Location.Speed;
                textBlock1.Text = "Distance: " + path.ToString() + " m";
            }
        }
Example #14
0
 void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (currentState == GeoPositionStatus.Ready)
     {
         CurrentGeoCoord = e.Position;
     }
 }
Example #15
0
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            // calculate distances
            var dist = Utilities.ConvertToMiles(Utilities.Distance(e.Position.Location.Latitude, e.Position.Location.Longitude, location.Latitude, location.Longitude));

            this.txtDescription.Text = dist.ToString("0.00") + " miles away";
        }
Example #16
0
        private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            Logger.Log(String.Format("Position changed: Unknown: {2}, Lat: {0}, Long: {1}", e.Position.Location.Latitude.ToString(), e.Position.Location.Longitude.ToString(), e.Position.Location.IsUnknown));
            this.currentGeoLocation = e.Position.Location;

            OnNewLocationAvailable();
        }
Example #17
0
 private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     Coordenada?.Invoke(this, new CoordenadasEventArgs()
     {
         Coordenadas = new Point3D(e.Position.Location.Longitude, e.Position.Location.Latitude, e.Position.Location.Altitude)
     });
 }
        private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            var coord = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

            TimeSpan time          = TimeSpan.FromTicks(System.Environment.TickCount - _previousPositionChangeTick);
            double   secondsFromTs = time.TotalSeconds;

            if (_line.Path.Count > 0)
            {
                var previousPoint = _line.Path.Last();
                var distance      = coord.GetDistanceTo(previousPoint);

                _kilometres += distance / 1000.0;
                double metersPerSecond    = (distance / (secondsFromTs * 1000));
                double kilometersPerHours = (metersPerSecond * 3.6);

                speedTextBlock.Text    = string.Format("{0:f2} Km/H", kilometersPerHours.ToString("0.0"));
                distanceTextBlock.Text = string.Format("{0:f2} km", _kilometres);

                PositionHandler handler = new PositionHandler();
                var             heading = handler.CalculateBearing(new Position(previousPoint), new Position(coord));
                Map.SetView(coord, Map.ZoomLevel, heading, MapAnimationKind.Parabolic);
            }

            else
            {
                Map.Center = coord;
            }

            _line.Path.Add(coord);
            _previousPositionChangeTick = System.Environment.TickCount;
        }
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if (e.Position.Location.IsUnknown)
            {
                MessageBox.Show("Please wait while your prosition is determined....");
                return;
            }

            this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

            if (this.map.Children.Count > 1)
            {
                var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));

                if (pushpin != null)
                {
                    this.map.Children.Remove(pushpin);
                }
            }

            this.pushPin.Tag      = "locationPushpin";
            this.pushPin.Location = watcher.Position.Location;
            this.map.Center       = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
            this.map.SetView(watcher.Position.Location, 16.0);
        }
        private void GeoWatcherPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            var accuracy = e.Position.Location.HorizontalAccuracy;

            loadData(e.Position.Location.Latitude.ToString(), e.Position.Location.Longitude.ToString());
            _geoWatcher.Stop();
        }
        void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            var position = e.Position.Location;

            lblLatidude.Text = position.Latitude.ToString("0.0000");
            lblLongitude.Text = position.Longitude.ToString("0.0000");
        }
Example #22
0
 void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         map1.Center = e.Position.Location;
     });
 }
    private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
    {
      var coord = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

      if (_line.Path.Count > 0)
      {
        var previousPoint = _line.Path.Last();
        var distance = coord.GetDistanceTo(previousPoint);
        var millisPerKilometer = (1000.0 / distance) * (System.Environment.TickCount - _previousPositionChangeTick);
        _kilometres += distance / 1000.0;

        paceLabel.Text = TimeSpan.FromMilliseconds(millisPerKilometer).ToString(@"mm\:ss");
        distanceLabel.Text = string.Format("{0:f2} km", _kilometres);
        caloriesLabel.Text = string.Format("{0:f0}", _kilometres * 65); // an average of 65 calories burned per kilometer

                PositionHandler handler = new PositionHandler();
        var heading = handler.CalculateBearing(new Position(previousPoint), new Position(coord));
        Map.SetView(coord, Map.ZoomLevel, heading, MapAnimationKind.Parabolic);

        ShellTile.ActiveTiles.First().Update(new IconicTileData()
        {
          Title = "WP8Runner",
          WideContent1 = string.Format("{0:f2} km", _kilometres),
          WideContent2 = string.Format("{0:f0} calories", _kilometres * 65), // an average of 65 calories burned per kilometer
        });
      }
      else
      {
        Map.Center = coord;
      }

      _line.Path.Add(coord);
      _previousPositionChangeTick = System.Environment.TickCount;
    }
Example #24
0
        private void WatcherOnPositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if (DateTime.Now.TimeOfDay.Subtract(_lastTimeSend) >= _minSendTime)
            {
                _geozoneRequest.Lat = e.Position.Location.Latitude;
                _geozoneRequest.Lon = e.Position.Location.Longitude;

                WebClient webClient = new WebClient();
                webClient.UploadStringCompleted += (o, args) =>
                {
                    if (args.Error == null)
                    {
                        JObject jRoot = JObject.Parse(args.Result);

                        if (JsonHelpers.GetStatusCode(jRoot) == 200)
                        {
                            double dist = jRoot["response"].Value <double>("distance");
                            if (dist > 0)
                            {
                                LazyWatcher.MovementThreshold = dist / 2;
                            }
                        }
                    }
                };
                string request = string.Format("{{\"request\":{0}}}", JsonConvert.SerializeObject(_geozoneRequest));
                webClient.UploadStringAsync(Constants.GeozoneUrl, request);

                _lastTimeSend = DateTime.Now.TimeOfDay;
            }
        }
Example #25
0
        void OnGeoWatcherPositionChanged(object sender,
                                         GeoPositionChangedEventArgs <GeoCoordinate> args)
        {
            // Turn off GeoWatcher
            geoWatcher.PositionChanged -= OnGeoWatcherPositionChanged;
            geoWatcher.Stop();

            // Set coordinates to title text
            GeoCoordinate coord = args.Position.Location;

            ApplicationTitle.Text += ": " + String.Format("{0:F2}°{1} {2:F2}°{3}",
                                                          Math.Abs(coord.Latitude),
                                                          coord.Latitude > 0 ? 'N' : 'S',
                                                          Math.Abs(coord.Longitude),
                                                          coord.Longitude > 0 ? 'E' : 'W');
            // Query proxy for AreaBoundingBox
            LonLatPt center = new LonLatPt();

            center.Lon = args.Position.Location.Longitude;
            center.Lat = args.Position.Location.Latitude;

            statusText.Text = "Accessing Microsoft Research Maps Service...";
            proxy.GetAreaFromPtAsync(center, 1, Scale.Scale16m, (int)ContentPanel.ActualWidth,
                                     (int)ContentPanel.ActualHeight);
        }
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> args)
 {
     if (LocationChanged != null)
         LocationChanged(sender, new LocationChangedEventArgs(
             new Location(args.Position.Location.Latitude, args.Position.Location.Longitude, args.Position.Timestamp)
             ));
 }
Example #27
0
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {



            if (e.Position.Location.IsUnknown)
            {
                MessageBox.Show("Please wait while your prosition is determined....");
                return;
            }

            this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

            if (this.map.Children.Count != 0)
            {
                var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));

                if (pushpin != null)
                {
                    this.map.Children.Remove(pushpin);
                    
                }
            }

            Pushpin locationPushpin = new Pushpin();
            locationPushpin.Background = new SolidColorBrush(Colors.Purple);
            locationPushpin.Content = "You are here";
            locationPushpin.Tag = "locationPushpin";
            locationPushpin.Location = watcher.Position.Location;
            this.map.Children.Add(locationPushpin);
            this.map.SetView(watcher.Position.Location, 10.0);
            
            Pushpin hospitalPushpin = new Pushpin();
            Pushpin hospital_Pushpin = new Pushpin();
            Pushpin hospital__Pushpin = new Pushpin();
            
            //hospitalPushpin.Location = watcher.Position.Location;

            String phoneNo = "07069779250";
            hospitalPushpin.Content = "Bingham University Clinic"+"\n"+phoneNo;
            hospitalPushpin.Location = new GeoCoordinate(8.957914, 7.699131);
            //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
            hospitalPushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
            this.map.Children.Add(hospitalPushpin);

            String phone_No = "08139698896";
            hospital_Pushpin.Content = "General Hospital Wuse" + "\n" + phone_No;
            hospital_Pushpin.Location = new GeoCoordinate(9.062964, 7.469072);
            //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
            hospital_Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
            this.map.Children.Add(hospital_Pushpin);

            String phone__No = "08139698896";
            hospital__Pushpin.Content = "General Hospital Karu" + "\n" + phone__No;
            hospital__Pushpin.Location = new GeoCoordinate(9.026158, 7.61304);
            //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
            hospital__Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
            this.map.Children.Add(hospital__Pushpin);
            }
Example #28
0
        private void WatcherPositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            _currentCoords = e.Position.Location;

            var epl = e.Position.Location;

            textBlock1.Text = epl.Latitude.ToString("0.00000") + ", " + epl.Longitude.ToString("0.00000");
        }
Example #29
0
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (!e.Position.Location.IsUnknown)
     {
         watcher.Stop();
         PositionDetermined(new PositionDeterminedEventArgs(GetPositionFromGeoCoordinate(e.Position.Location)));
     }
 }
 private void _gcw_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (e.Position == null || e.Position.Location == null)
     {
         return;
     }
     CurrentLocation = e.Position.Location;
 }
Example #31
0
 static void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     _locationFromLastGpsUpdate = new Location
     {
         Latitude = _geoWatcher.Position.Location.Latitude,
         Longitude = _geoWatcher.Position.Location.Longitude,
     };
 }
Example #32
0
        private static void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            Watcher.Stop();

            Console.WriteLine($"Position Changed: {e.Position.Location}");

            MapImage.Show(e.Position.Location);
        }
 private void LocationServiceValueCallback(GeoPositionChangedEventArgs<GeoCoordinate> value)
 {
     MapDemo.Children.Clear();
     MapDemo.Center = new GeoCoordinate(value.Position.Location.Latitude, value.Position.Location.Longitude);
     Pushpin pin = new Pushpin();
     pin.Location = new GeoCoordinate(value.Position.Location.Latitude, value.Position.Location.Longitude);
     MapDemo.Children.Add(pin);
 }
Example #34
0
 void LocationSensor_PositionChanged
     (object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     LatitudeText.Text  = String.Format("{0:0.00}", e.Position.Location.Latitude);
     LongitudeText.Text = String.Format("{0:0.00}", e.Position.Location.Longitude);
     AltitudeText.Text  = e.Position.Location.Altitude.ToString();
     TimestampText.Text = e.Position.Timestamp.ToLocalTime().ToString();
 }
Example #35
0
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (callback != null)
     {
         callback(e.Position.Location);
     }
     disposeWatcher();
 }
Example #36
0
 private void OnPositionChange(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (!(e.Position.Location.IsUnknown))
     {
         coordinate = e.Position.Location;
         CallUpdateEvent();
     }
 }
Example #37
0
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     if (!e.Position.Location.IsUnknown)
     {
         CurrentPosition = e.Position.Location;
         Watcher.Stop();
     }
 }
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            UpdateLocationValue(e);
            mGPSlatitude  = e.Position.Location.Latitude.ToString("0.000");
            mGPSlongitude = e.Position.Location.Longitude.ToString("0.000");

            System.Diagnostics.Debug.WriteLine(mGPSlatitude + "-- - " + mGPSlongitude);
        }
Example #39
0
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     if (!e.Position.Location.IsUnknown)
     {
         watcher.Stop();
         PositionDetermined(new PositionDeterminedEventArgs(GetPositionFromGeoCoordinate(e.Position.Location)));
     }
 }
Example #40
0
        void gps_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            txtLatitud.Text = gps.Position.Location.Latitude.ToString();
            txtLongitud.Text = gps.Position.Location.Longitude.ToString();
            txtAltitud.Text = gps.Position.Location.Altitude.ToString();
           

        }
Example #41
0
 private void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     //throw new NotImplementedException();
     currentLocation = e.Position.Location;
     double currentAltitude  = e.Position.Location.Altitude;
     double currentLongitude = e.Position.Location.Longitude;
     double currnetLatitude  = e.Position.Location.Latitude;
 }
 private void _gcw_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if (e.Position == null || e.Position.Location == null)
     {
         return;
     }
     MakeReverseGeocodeRequest(e.Position.Location);
 }
 void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     if ((pos.Latitude != e.Position.Location.Latitude) && (pos.Longitude != e.Position.Location.Longitude))
     {
         pos = new Position(e.Position.Location.Latitude, e.Position.Location.Longitude);
         MessagingCenter.Send <IGeoLocation, Position>(this, "LocationChanged", pos);
     } //end if
 }
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            tbTimeAcquired.Text = e.Position.Timestamp.ToString();
            tbLatitude.Text = e.Position.Location.Latitude.ToString();
            tbLongtitude.Text = e.Position.Location.Longitude.ToString();

            System.Diagnostics.Debug.WriteLine("watcher_PositionChanged + " + DateTime.Now.Second);
        }
 void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     if ((pos.Latitude != e.Position.Location.Latitude) && (pos.Longitude != e.Position.Location.Longitude))
     {
         pos = new Position(e.Position.Location.Latitude, e.Position.Location.Longitude);
         MessagingCenter.Send<IGeoLocation, Position>(this, "LocationChanged", pos);
     } //end if
 }
Example #46
0
 void gcw_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     lat.Text = e.Position.Location.Latitude.ToString();
     lon.Text = e.Position.Location.Longitude.ToString();
     alt.Text = e.Position.Location.Altitude.ToString();
     pre.Text = e.Position.Location.HorizontalAccuracy.ToString();
     SaveFile(string.Format("{{ 'IDPosizione' : 0, 'FKIDViaggio' : 1, 'Data': \"{0}\", 'Latitudine': {1}, 'Longitudine': {2}, 'Precisione': {3}}},", e.Position.Timestamp.ToString(), e.Position.Location.Latitude, e.Position.Location.Longitude, e.Position.Location.HorizontalAccuracy));
 }
Example #47
0
        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if (null == Me)
            {
                App.Log("I don't exist.");
                return;
            }

            if (Me.Location.IsUnknown)
            {
                App.Log("The map moved, but I don't know where I am!");
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                if (CurrentLocation != null && CurrentLocation.IsUnknown)
                {
                    _here       = DefaultLocation;
                    Me.Location = DefaultLocation;
                }
                else
                {
                    _here       = e.Position.Location;
                    Me.Location = e.Position.Location;
                }
            }
            else
            {
                _here       = e.Position.Location;
                Me.Location = e.Position.Location;
            }
            if (!Me.Location.IsUnknown)
            {
                ShowMe = true;
            }

            if (firstfind || follow)
            {
                App.Log("   Centering for first time, or following location");
                CenterLocation();
            }

            if (firstfind)
            {
                Zoom               = DefaultZoomLevel;
                zoomlevel          = Zoom;
                firstfind          = false;
                Map.Visibility     = System.Windows.Visibility.Visible;
                waitBar.Visibility = System.Windows.Visibility.Collapsed;
            }
            App.Log(string.Format("  Position changed: Zoom={0}, zoomLevel={1}, Map.TargetZoom={2}", Zoom, zoomlevel, Map.TargetZoomLevel));

            NotifyPropertyChanged("Pushpins");
            NotifyPropertyChanged("Me");
            NotifyPropertyChanged("CurrentLocation");
            App.Log("  Setting thread wait from watcher_PositionChanged");
            wait.Set();
        }
Example #48
0
        void gcw_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            this.gcw.Stop();

            adControl1.Latitude  = e.Position.Location.Latitude;
            adControl1.Longitude = e.Position.Location.Longitude;

            Debug.WriteLine("Device lat/long: " + e.Position.Location.Latitude + ", " + e.Position.Location.Longitude);
        }
Example #49
0
 public void coordinateWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     if (!e.Position.Location.IsUnknown)
     {
         Latitude = e.Position.Location.Latitude;
         Longitude = e.Position.Location.Longitude;
         mapMain.Center = new GeoCoordinate(Latitude, Longitude);
     }
 }
 private void _geoCoordinateWatcher_PositionChanged(object sender
                                                    , GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         txtLatitude.Text  = e.Position.Location.Latitude.ToString();
         txtLongitude.Text = e.Position.Location.Longitude.ToString();
     });
 }
 private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     currentLocation  = new Microsoft.Maps.MapControl.WPF.Location(e.Position.Location.Latitude, e.Position.Location.Longitude);
     currentLongitude = e.Position.Location.Longitude.ToString();
     currentLatitude  = e.Position.Location.Latitude.ToString();
     RaisePropertyChanged("currentLongitude");
     RaisePropertyChanged("currentLatitude");
     RaisePropertyChanged("CurrentLocation");
 }
Example #52
0
 private void PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     UpdatePositionList(e.Position);
     var geoCoordinateWatcher = sender as GeoCoordinateWatcher;
     if (geoCoordinateWatcher != null)
     {
         geoCoordinateWatcher.PositionChanged -= PositionChanged;
     }
 }
Example #53
0
 void GcwPositionChanged(GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         // thread safe
         tbLatitude.Text  = e.Position.Location.Latitude.ToString();
         tbLongitude.Text = e.Position.Location.Longitude.ToString();
     });
 }
        private void locationPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            if (userPushpin == null)
                return;

            mapControl.Items.Remove(userPushpin);

            addPushpin(userPushpin, actualLocation.Position.Location);
        }
        /// <summary>
        /// Raises the <see cref="E:PositionChanged" /> event.
        /// </summary>
        /// <param name="e">The <see cref="GeoPositionChangedEventArgs{GeoCoordinate}" /> instance containing the event data.</param>
        protected override void OnPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            var eventHandler = PositionChanged;

            if (eventHandler != null)
            {
                eventHandler(this, e);
            }
        }
Example #56
0
 void GcwPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         // thread safe
         tbLatitude.Text = e.Position.Location.Latitude.ToString();
         tbLongitude.Text = e.Position.Location.Longitude.ToString();
     });
 }
Example #57
0
 void gps_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     mapa.Center = gps.Position.Location;
 
     ppin.Location = gps.Position.Location;
         
     mapa.SetView(ppin.Location, 15);
     
 }
Example #58
0
 void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
 {
     if (watcher.Position.Location.Longitude <= 180)
     {
         Latitude = (float)watcher.Position.Location.Latitude;
         Longitude = (float)watcher.Position.Location.Longitude;
         watcher.Stop();
         UpdatePositionVisualisation();
     }
 }
Example #59
0
        private void gcw_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            // Stop the GeoCoordinateWatcher now that we have the device location.
            this.gcw.Stop();

            adControl1.Latitude = e.Position.Location.Latitude;
            adControl1.Longitude = e.Position.Location.Longitude;

            Debug.WriteLine("Device lat/long: " + e.Position.Location.Latitude + ", " + e.Position.Location.Longitude);
        }
Example #60
0
        private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            map2.Center = e.Position.Location;
            map2.ZoomLevel = 17;

            if (e.Position.Location.IsUnknown)
            {
                MessageBox.Show("Please wait while your position is determined....");
                return;
            }
        }