protected virtual void onNewLocationReceiveEvent(LocationChangedEventArgs args) { if (!gpsConnector.isClosingGps) if (newLocationReceived != null) { newLocationReceived(this, args); } }
protected void gps_LocationChanged(object sender, LocationChangedEventArgs args) { position = args.Position; // call the UpdateData method via the updateDataHandler so that we // update the UI on the UI thread Invoke(updateDataHandler); }
//execute if location is changed to update form component and save data to database public void Form1_NewLocationReceived(object sender, LocationChangedEventArgs e) { if (!gpsConnector.isClosingGps) { GpsPosition position = e.Position; try { //check gps connection - if gps not open then open gps gpsConnector.openGps(); //retrive position to save gps data to database gpsConnector.retrivePosition(position); } catch (Exception ex) { MessageBox.Show("new loc"+ex.Message); } } }
private void gps_LocationChanged(object sender, Microsoft.WindowsMobile.Samples.Location.LocationChangedEventArgs args) { if (args.Position == null) { return; } OnPosition(new GpsPositionEventArgs(new GpsPosition( AdvancedConfig.SeaLevelAltitude ? args.Position.EllipsoidAltitudeValid ? new decimal?((decimal)args.Position.EllipsoidAltitude) : null : args.Position.SeaLevelAltitudeValid ? new decimal?((decimal)args.Position.SeaLevelAltitude) : null, args.Position.LongitudeValid ? new decimal?((decimal)args.Position.Longitude) : null, args.Position.LatitudeValid ? new decimal?((decimal)args.Position.Latitude) : null, args.Position.TimeValid ? args.Position.Time : DateTime.MinValue))); if (args.Position.SatellitesInViewValid) { List <int> usedSats = new List <int>(); if (args.Position.SatellitesInSolutionValid) { foreach (var sat in args.Position.GetSatellitesInSolution()) { usedSats.Add(sat.Id); } } List <GpsSatellite> sats = new List <GpsSatellite>(args.Position.SatellitesInViewCountValid ? args.Position.SatellitesInViewCount : 3); var visibleSats = args.Position.GetSatellitesInView(); if (visibleSats != null) { foreach (var sat in visibleSats) { sats.Add(new GpsSatellite(sat.Id, sat.SignalStrength, sat.Elevation, sat.Azimuth, usedSats.Contains(sat.Id))); } } OnSatellite(new GpsSatelliteEventArgs(sats.ToArray())); } if (args.Position.SpeedValid) { OnMovement(new GpsMovementEventArgs((decimal)args.Position.Speed * (decimal)1.852)); } }
protected void gps_LocationChanged(object sender, LocationChangedEventArgs args) { position = args.Position; // call the UpdateData method via the updateDataHandler so that we // update the UI on the UI thread try { BeginInvoke(updateDataHandler); } catch (NullReferenceException ) { } }
private void gps_LocationChanged(object sender, LocationChangedEventArgs args) { //this.tCoordenate.Text = ""; GpsPosition position = args.Position; ControlUpdater cu = UpdateControl; if (position.LatitudeValid && position.LongitudeValid) { String coordenadas = position.Latitude.ToString() + " " + position.Longitude.ToString(); this.coordenateX = position.Latitude.ToString("000000.00"); this.coordenateY = position.Longitude.ToString("000000.00"); //Invoke(cu, tCoordenate, coordenadas); } //if (position.LongitudeValid) //Invoke(cu, txtgpslong, position.Longitude.ToString()); //tCoordenate.Text =position.Latitude.ToString()+" "+position.Longitude.ToString(); /*if (position.HeadingValid) Invoke(cu, txtgpsheading, position.Heading.ToString()); if (position.SatellitesInViewCountValid) Invoke(cu, txtgpssatellite, position.SatellitesInViewCount.ToString());*/ }
private void OnLocationChanged(object sender, LocationChangedEventArgs args) { Log.Info("LocationService.OnLocationChanged", "lat={0} long={1}", args.Position.Latitude, args.Position.Longitude); Timer.Enabled = false; if (LocationChanged != null) { LocationChanged(this, new LocationEventArgs(args.Position.Latitude, args.Position.Longitude, string.Empty, args.Position.LatitudeValid, args.Position.LongitudeValid)); } }
//execute if current location is changed public void gps_LocationChanged(object sender, LocationChangedEventArgs args) { if(!gpsConnector.isClosingGps) onNewLocationReceiveEvent(args); }
private void gps_LocationChanged(object sender, LocationChangedEventArgs args) { GpsPosition position = args.Position; ControlUpdater cu = UpdateControl; if (position.LatitudeValid && position.LongitudeValid) { String coordenadas = position.Latitude.ToString() + " " + position.Longitude.ToString(); this.coordenateX = position.Latitude.ToString("000000.00"); this.coordenateY = position.Longitude.ToString("000000.00"); } }
static void gps_LocationChanged(object sender, LocationChangedEventArgs args) { position = args.Position; }
void _gps_LocationChanged(object sender, LocationChangedEventArgs args) { GpsPosition = args.Position; PrintLn("GPS Location Changed: " + ToString(GpsPosition)); }