void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The location service is disabled or unsupported. // Alert the user StatusTextBlock.Text = "Location is unsupported on this device"; break; case GeoPositionStatus.Initializing: // The location service is initializing. // Disable the Start Location button StatusTextBlock.Text = "Initializing location service"; break; case GeoPositionStatus.NoData: // The location service is working, but it cannot get location data // Alert the user and enable the Stop Location button StatusTextBlock.Text = "Data unavailable"; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data // Show the current position and enable the Stop Location button StatusTextBlock.Text = "Ready - retrieving data"; break; } }
void _watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { GpsActive = true; } }
/// <summary> /// Updates the locatin, if the watcher is ready. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">The event arguments.</param> private static void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready && !LocationQueryService.Watcher.Position.Location.IsUnknown) { LocationQueryService.SetLocation(); } }
private void StatusChangedHandler(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: if (gcw.Permission == GeoPositionPermission.Denied) status = "Permission denied"; else status = "GPS is not supported"; MessageBox.Show(status); break; case GeoPositionStatus.Initializing: break; case GeoPositionStatus.NoData: status = "Cannot retrieve data"; MessageBox.Show(status); break; case GeoPositionStatus.Ready: status = "Data retrieved"; break; default: break; } }
protected void OnLocationFailed(object sender, GeoPositionStatusChangedEventArgs e) { ShowLocationFailedMessage(); this.isPhoneLocationServicesAvailbale = false; DeviceLocationInfo.Current.LocationFailed -= OnLocationFailed; RefreshList(); }
void MyStatusChanged(GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The location service is disabled or unsupported. // Alert the user //"location is unsupported on this device"; break; case GeoPositionStatus.Initializing: // The location service is initializing. // Disable the Start Location button //"initializing location service," + accuracyText; break; case GeoPositionStatus.NoData: // The location service is working, but it cannot get location data // Alert the user and enable the Stop Location button //"data unavailable," + accuracyText; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data // Show the current position and enable the Stop Location button //"receiving data, " + accuracyText; break; } }
private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) // Find GeoLocation of Device { try { if (e.Status == GeoPositionStatus.Ready) { if (watcher.Position.Location.IsUnknown) { caseData.DataTam.DuLieu.kinhdo = "0"; caseData.DataTam.DuLieu.vido = "0"; } else { caseData.DataTam.DuLieu.vido = watcher.Position.Location.Latitude.ToString(); caseData.DataTam.DuLieu.kinhdo = watcher.Position.Location.Longitude.ToString(); } } else { caseData.DataTam.DuLieu.kinhdo = "0"; caseData.DataTam.DuLieu.vido = "0"; } } catch (Exception) { caseData.DataTam.DuLieu.kinhdo = "0"; caseData.DataTam.DuLieu.vido = "0"; } }
private void gcw_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { //throw new NotImplementedException(); if (e.Status == GeoPositionStatus.Ready) { GeoCoordinate coord = gcw.Position.Location; String CurLatLocation = coord.Latitude.ToString("0.000"); String CurLonLocation = coord.Longitude.ToString("0.000"); latitude.Text = "Latitude: " + CurLatLocation; longitude.Text = "Longitude: " + CurLonLocation; //After you have the location, stop the service to conserve power gcw.Stop(); //Open Web Browser to navigate to Google Map using the current location from GPS; WebBrowserTask WebBrowserTask = new WebBrowserTask(); WebBrowserTask.Uri = new Uri("http://maps.google.com/maps?q=" + CurLatLocation + "," + CurLonLocation); WebBrowserTask.Show(); } if (e.Status == GeoPositionStatus.Disabled || e.Status == GeoPositionStatus.NoData) { latitude.Text = "GPS Disabled"; longitude.Text = "Please turn on your Location Service (GPS) in the system setting."; gcw.Stop(); } }
void geoWatch_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (geoWatch.Status == GeoPositionStatus.Disabled) { if (geoWatch.Permission == GeoPositionPermission.Denied) { MessageBox.Show("Location services on your device are disabled."); } else { MessageBox.Show("Location services on your device are not functioning."); } geoWatch.StatusChanged -= new EventHandler <GeoPositionStatusChangedEventArgs>(geoWatch_StatusChanged); geoWatch.Stop(); } else if (geoWatch.Status == GeoPositionStatus.Initializing) { return; } else if (geoWatch.Status == GeoPositionStatus.NoData) { MessageBox.Show("Location data is not available"); } else if (geoWatch.Status == GeoPositionStatus.Ready) { App.ViewModel.IsLoading = false; AddUserPushpin(); } }
/// <summary> /// Custom method called from the StatusChanged event handler /// </summary> /// <param name="e"></param> void MyStatusChanged(GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The location service is disabled or unsupported. // Alert the user StatusTextBlock.Text = "location is unsupported on this device"; break; case GeoPositionStatus.Initializing: // The location service is initializing. // Disable the Start Location button StatusTextBlock.Text = "initializing location service," + accuracyText; break; case GeoPositionStatus.NoData: // The location service is working, but it cannot get location data // Alert the user and enable the Stop Location button StatusTextBlock.Text = "data unavailable," + accuracyText; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data // Show the current position and enable the Stop Location button StatusTextBlock.Text = "receiving data, " + accuracyText; break; } }
void MyStatusChanged(GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The location service is disabled or unsupported. // Alert the user tbStatus.Text = "GPS data disabled"; break; case GeoPositionStatus.Initializing: // The location service is initializing. // Disable the Start Location button tbStatus.Text = "looking for you…"; break; case GeoPositionStatus.NoData: // The location service is working, but it cannot get location data // Alert the user and enable the Stop Location button tbStatus.Text = "No GPS data"; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data // Show the current position and enable the Stop Location button tbStatus.Text = "Ready!"; break; } }
public async void ubicacion_estado(object sender, GeoPositionStatusChangedEventArgs e) { try { switch (e.Status) { case GeoPositionStatus.Disabled: if (ubicacion.Permission == GeoPositionPermission.Denied) { await speechSynth.SpeakTextAsync("Debes activar tu ubicacion en : Configuración, ubicación, activar ubicación. Error De Localizacion"); } else { await speechSynth.SpeakTextAsync("Servicio de localizacion sin funcionamiento"); } break; case GeoPositionStatus.Initializing: break; case GeoPositionStatus.NoData: await speechSynth.SpeakTextAsync("Datos no disponibles."); break; case GeoPositionStatus.Ready: break; } } catch { error2(); } }
private static void GeoWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { GpsIsReady = true; } }
void geolocator_StatusChanged(object sender, GeoPositionStatusChangedEventArgs args) { string status = ""; switch (args.Status) { case GeoPositionStatus.Disabled: // the application does not have the right capability or the location master switch is off status = "Disabled"; break; case GeoPositionStatus.Initializing: // the geolocator started the tracking operation status = "initializing"; break; case GeoPositionStatus.NoData: // the location service was not able to acquire the location status = "no data"; break; case GeoPositionStatus.Ready: // the location service is generating geopositions as specified by the tracking parameters status = "Ready"; break; default: status = "N/A"; break; } statusBox.Text = status; }
void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { GeoCoordinate coord = watcher.Position.Location; if (coord.IsUnknown != true) { GeraetX = coord.Latitude; GeraetY = coord.Longitude; try { Stationssuche stationssuche = new Stationssuche(); Stations naechstebahnhofe = stationssuche.Neachstestatonfinden(Convert.ToString(GeraetX), Convert.ToString(GeraetY)); List <Station> nachstebahnhofliste = naechstebahnhofe.StationList; foreach (Station bahnhof in nachstebahnhofliste.Take(5)) { dgvNaechsteStation.Rows.Add(bahnhof.Name, bahnhof.Distance); } this.Refresh(); watcher.Stop(); } catch { MessageBox.Show("Keine Station gefunden!"); return; } } else { MessageBox.Show("Unbekannte Koordinaten!"); System.Threading.Thread.Sleep(1000); } }
private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { // Display the latitude and longitude. if (Watcher.Position.Location.IsUnknown) { MessageBox.Show("Cannot find location data"); } else { var pushpin = new Pushpin(); GeoCoordinate location = Watcher.Position.Location; pushpin.Location = new Location(location.Latitude, location.Longitude); BrushConverter k = new BrushConverter(); pushpin.Background = (Brush)k.ConvertFrom("Red"); bing_map.Children.Add(pushpin); SqlConnection cn = Connect(".\\SQLEXPRESS", "mydb"); SqlCommand cmd = new SqlCommand { Connection = cn, CommandText = "Update echange set lat =" + location.Latitude.ToString("G", CultureInfo.InvariantCulture) + ", long = " + location.Longitude.ToString("G", CultureInfo.InvariantCulture) + " where moi = 'true'" }; cn.Open(); cmd.ExecuteNonQuery(); cn.Close(); } } }
void gps_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Initializing: break; case GeoPositionStatus.Ready: try { // x = gps.Position.Location.Latitude; // y = gps.Position.Location.Longitude; } catch { MessageBox.Show("No encontramos tu ubicacion pero te situamos en providencia ;) "); } break; case GeoPositionStatus.NoData: Console.WriteLine("No podemos saber tu ubicacion, colocamos la ultima conocida"); break; case GeoPositionStatus.Disabled: Console.WriteLine("Has desabilitado el GPS, para volver al mapa debes activarlo"); break; } }
private void MyStatusChanged(GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: txtGpsEnabled.Text = "Disabled"; //Stop the Location Service to conserve battery power. watcher.Stop(); break; case GeoPositionStatus.Initializing: // The Location Service is initializing. txtGpsEnabled.Text = "Enabled"; //Stop the Location Service to conserve battery power. watcher.Stop(); break; case GeoPositionStatus.NoData: // The Location Service is working, but it cannot get location data. txtGpsEnabled.Text = "Enabled"; //Stop the Location Service to conserve battery power. watcher.Stop(); break; case GeoPositionStatus.Ready: // The Location Service is working and is receiving location data. txtGpsEnabled.Text = "Enabled"; //Stop the Location Service to conserve battery power. watcher.Stop(); break; } }
private void OnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.NoData: case GeoPositionStatus.Disabled: Permission = MvxLocationPermission.Denied; var errorCode = _geoWatcher.Permission == GeoPositionPermission.Denied ? MvxLocationErrorCode.PermissionDenied : MvxLocationErrorCode.PositionUnavailable; SendError(errorCode); break; case GeoPositionStatus.Initializing: case GeoPositionStatus.Ready: Permission = MvxLocationPermission.Granted; // not an error - so ignored break; default: // other codes ignored // TODO do other codes affect Permission? break; } }
public static void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The Location Service is disabled or unsupported. // Check to see whether the user has disabled the Location Service. if (watcher.Permission == GeoPositionPermission.Denied) { // The user has disabled the Location Service on their device. hasLocationData = false; } else { hasLocationData = false; } break; case GeoPositionStatus.NoData: // The Location Service is working, but it cannot get location data. // Alert the user and enable the Stop Location button. hasLocationData = false; break; case GeoPositionStatus.Ready: // The Location Service is working and is receiving location data. // Show the current position and enable the Stop Location button. lat = watcher.Position.Location.Latitude; lng = watcher.Position.Location.Longitude; hasLocationData = true; watcher.Stop(); break; } }
// The watcher's status has change. See if it is ready. private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { if (Watcher.Position.Location.IsUnknown) { textBoxAltitude.Text = "0"; textBoxLatitudeDecimal.Text = "0.0"; textBoxLongitudeDecimal.Text = "0.0"; } else { textBoxAltitude.Text = Watcher.Position.Location.Altitude.ToString(); textBoxLatitudeDecimal.Text = Watcher.Position.Location.Latitude.ToString(); textBoxLongitudeDecimal.Text = Watcher.Position.Location.Longitude.ToString(); } textBoxLatitudeDecimal_Validated(textBoxLatitudeDecimal, new EventArgs()); textBoxLongitudeDecimal_Validated(textBoxLongitudeDecimal, new EventArgs()); } }
void geolocator_StatusChanged(object sender, GeoPositionStatusChangedEventArgs args) { string status = ""; switch (args.Status) { case GeoPositionStatus.Disabled: // the application does not have the right capability or the location master switch is off status = "Disabled"; break; case GeoPositionStatus.Initializing: // the geolocator started the tracking operation status = "initializing"; break; case GeoPositionStatus.NoData: // the location service was not able to acquire the location status = "no data"; break; case GeoPositionStatus.Ready: // the location service is generating geopositions as specified by the tracking parameters status = "Ready"; break; default: status = "N/A"; break; } statusBox.Text = status; }
void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The location service is disabled or unsupported. // Alert the user StatusTextBlock.Text = "Location is unsupported on this device"; break; case GeoPositionStatus.Initializing: // The location service is initializing. // Disable the Start Location button StatusTextBlock.Text = "Initializing location service"; break; case GeoPositionStatus.NoData: // The location service is working, but it cannot get location data // Alert the user and enable the Stop Location button StatusTextBlock.Text = "Data unavailable"; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data // Show the current position and enable the Stop Location button StatusTextBlock.Text = "Ready - retrieving data"; break; } }
private void OnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.NoData: case GeoPositionStatus.Disabled: Permission = MvxLocationPermission.Denied; var errorCode = _geoWatcher.Permission == GeoPositionPermission.Denied ? MvxLocationErrorCode.PermissionDenied : MvxLocationErrorCode.PositionUnavailable; SendError(errorCode); break; case GeoPositionStatus.Initializing: case GeoPositionStatus.Ready: Permission = MvxLocationPermission.Granted; // not an error - so ignored break; default: // other codes ignored // TODO do other codes affect Permission? break; } }
private void LocationWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Disabled) { LocationDisabled(true); } }
private void Wc_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { //Thread.Sleep(1000); if (e.Status == GeoPositionStatus.Ready) { button1.Visible = false; label4.Text = "Başlatılıyor..."; Thread.Sleep(1000); label4.Text = "Konum Bulunuyor..."; Thread.Sleep(1000); label4.Text = "Konum verilerine erişildi"; Thread.Sleep(1000); label4.Text = null; // Display the latitude and longitude. if (wc.Position.Location.IsUnknown) { MessageBox.Show("Konum Verilerine Erişilemedi ! Lütfen Konum Ayarlarınızı Yapılandırın", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { location = wc.Position.Location; trackBar1.Enabled = true; wc.Dispose(); } } else { label4.Text = "Konum Verilerine Erişilemedi !\nLütfen Konum Ayarlarınızı Yapılandırın"; // button1.Visible = true; } }
void _watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Disabled || _watcher.Permission == GeoPositionPermission.Denied) Dispose(); }
private void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The Location Service is disabled or unsupported. // Check to see if the user has disabled the Location Service. if (watcher.Permission == GeoPositionPermission.Denied) { // The user has disabled the Location Service on their device. statusString = "You have disabled Location Service."; } else { statusString = "Location Service is not functioning on this device."; } break; case GeoPositionStatus.Initializing: statusString = "Location Service is retrieving data..."; // The Location Service is initializing. break; case GeoPositionStatus.NoData: // The Location Service is working, but it cannot get location data. statusString = "Location data is not available."; break; case GeoPositionStatus.Ready: // The Location Service is working and is receiving location data. statusString = "Location data is available."; break; } }
static void locationWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (StatusChanged != null) { StatusChanged(sender, e); } }
static void locationWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (StatusChanged != null) { StatusChanged(sender, e); } }
private void OnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.NoData: case GeoPositionStatus.Disabled: var errorCode = _geoWatcher.Permission == GeoPositionPermission.Denied ? MvxLocationErrorCode.PermissionDenied : MvxLocationErrorCode.PositionUnavailable; SendError(errorCode); break; case GeoPositionStatus.Ready: #warning is it ok to not pass this on? /* * var position = CreateLocation(_geoWatcher.Position.Location); * position.Timestamp = _geoWatcher.Position.Timestamp; * _currentPositionCallback(position); */ break; default: #warning is it ok to ignore other codes? break; } }
private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { try { if (e.Status == GeoPositionStatus.Ready) { if (watcher.Position.Location.IsUnknown) { latitude = "0"; longitude = "0"; } else { latitude = watcher.Position.Location.Latitude.ToString(); longitude = watcher.Position.Location.Longitude.ToString(); } } else { longitude = "0"; latitude = "0"; } } catch (Exception) { longitude = "0"; latitude = "0"; } }
void coordinateWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { watcherInitialized = false; switch (e.Status) { case GeoPositionStatus.Disabled: break; case GeoPositionStatus.Initializing: StatusBar.Text = "Initializing"; break; case GeoPositionStatus.NoData: StatusBar.Text = "No data"; break; case GeoPositionStatus.Ready: StatusBar.Text = "Data feed started"; watcherInitialized = true; MapControl.ZoomLevel = 15; UpdatePosition(coordinateWatcher.Position.Location); traceLine.Locations.Add(userLocation.Location); InitializeCompass(); break; } }
private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { // Display the latitude and longitude. if (Watcher.Position.Location.IsUnknown) { MessageBox.Show("Cannot find location data"); } else { var latgeo = Watcher.Position.Location.Latitude; var longeo = Watcher.Position.Location.Longitude; map1.Position = new PointLatLng(latgeo, longeo); GMapMarker marker = new GMarkerGoogle(map1.Position, GMarkerGoogleType.red_small); marker.ToolTip = new GMapBaloonToolTip(marker); Brush ToolTipBackColor = new SolidBrush(Color.WhiteSmoke); marker.ToolTip.Fill = ToolTipBackColor; marker.ToolTipText = "\n You are Here"; marker.ToolTip.Font = new Font("Times New ROman", 12, FontStyle.Italic); GMapOverlay markers = new GMapOverlay("markers"); markers.Markers.Add(marker); map1.Overlays.Add(markers); map1.MinZoom = 5; map1.MaxZoom = 100; map1.Zoom = 10; map1.Zoom++; map1.Zoom--; } } }
private static void Ubicacion_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: MessageBox.Show(Ubicacion.Permission == GeoPositionPermission.Denied ? "El servicio de localización se encuentra deshabilitado. Por favor asegúrese de habilitarlo en las Opciones del dispositivo para utilizar las caracteristicas que lo requeran." : "El servicio de localización se encuentra sin funcionamiento."); App.Configuration.IsLocationEnabledByPhone = false; Ubicacion.Stop(); break; case GeoPositionStatus.Initializing: //Estado: Inicializando break; case GeoPositionStatus.NoData: //Estado: Datos no disponibles MessageBox.Show("El servicio de localización no puede obtener su posición."); Ubicacion.Stop(); break; case GeoPositionStatus.Ready: //Estado: Servicio de localización disponible App.Configuration.IsLocationEnabledByPhone = true; break; } }
void watcher_statusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The Location Service is disabled or unsupported. // Check to see if the user has disabled the location service. if (watcher.Permission == GeoPositionPermission.Denied) { // the user has disabled LocServ on their device. statusTextBlock.Text = "You have disabled Location Service."; } else { statusTextBlock.Text = "Location Service is not functioning on this device."; } break; case GeoPositionStatus.Initializing: // The location service is initializing. statusTextBlock.Text = "Location Service is retrieving data..."; break; case GeoPositionStatus.NoData: // The Location Service is working, but it cannot get location data // due to poor signal fidelity (most likely) statusTextBlock.Text = "Location data is not available."; break; case GeoPositionStatus.Ready: // The location service is working and is receiving location data. statusTextBlock.Text = "Location data is available."; break; } }
private void CoordinatWatcher_StatusChanged(object o, GeoPositionStatusChangedEventArgs e) { //Telegram.Api.Helpers.Execute.ShowDebugMessage(string.Format("MapView.StatusChanged [status={0}, accuracy={1}]", _coordinatWatcher.Status, _coordinatWatcher.Position.Location.HorizontalAccuracy)); if (e.Status == GeoPositionStatus.Ready || _coordinatWatcher.Position.Location != GeoCoordinate.Unknown) { CurrentLocation.Visibility = Visibility.Visible; CurrentLocation.Location = _coordinatWatcher.Position.Location; if (!CurrentLocation.Location.IsUnknown) { UpdateAttaching(true); } Distance = CurrentLocation.Location.GetDistanceTo(ContactLocation.Location); if (ViewModel.MessageGeo == null && !_contactLocationChoosen) { ContactLocation.Visibility = Visibility.Visible; ContactLocation.Location = _coordinatWatcher.Position.Location; Map.AnimationLevel = AnimationLevel.UserInput; Map.ZoomLevel = 16.0; Map.Center = _coordinatWatcher.Position.Location; SetContactLocationString(); } if (ViewModel.MessageGeo == null) { ViewModel.GetVenues(_coordinatWatcher.Position.Location); } } }
private void GeoMyStatusChanged(GeoPositionStatusChangedEventArgs e) { //Debug.WriteLine("GeoMyStatusChanged()"); switch (e.Status) { case GeoPositionStatus.Disabled: if (Geo_Watcher.Permission == GeoPositionPermission.Denied) { MessageBox.Show("Le service de localisation est désactivé sur cet appareil"); NavigationService.GoBack(); } else { MessageBox.Show("Le service de localisation ne fonctionne pas sur cet appareil"); NavigationService.GoBack(); } break; case GeoPositionStatus.NoData: MessageBox.Show("Données de localisation indisponibles"); break; case GeoPositionStatus.Ready: break; } }
void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: // The Location Service is disabled or unsupported. // Check to see whether the user has disabled the Location Service. if (this.watcher.Permission == GeoPositionPermission.Denied) { // The user has disabled the Location Service on their device. Utilities.CrossThreadMessageBox("You have disabled location services on this device."); } else { Utilities.CrossThreadMessageBox("Location is not functioning on this device."); } break; case GeoPositionStatus.NoData: // The Location Service is working, but it cannot get location data. Utilities.CrossThreadMessageBox("Location data is not available."); break; case GeoPositionStatus.Ready: Debug.WriteLine("GeoPositionStatus.Ready"); this.ready = true; this.watcher_PositionChanged(this, this.latestEventArgs); break; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: if (watcher.Permission == GeoPositionPermission.Denied) { RadMessageBox.Show("Location Denied", MessageBoxButtons.OK, "Location services on this device are denied. Please change them in settings to save location.", null, false, true, HorizontalAlignment.Stretch, VerticalAlignment.Top, null); } else { RadMessageBox.Show("Location Issues", MessageBoxButtons.OK, "There are issues with location services. Your location may not save now.", null, false, true, System.Windows.HorizontalAlignment.Stretch, System.Windows.VerticalAlignment.Top, null); } break; case GeoPositionStatus.Initializing: break; case GeoPositionStatus.Ready: break; default: break; } }
private void WatcherOnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { this.isEnabled = (this.watcher.Permission == GeoPositionPermission.Granted && this.watcher.Status != GeoPositionStatus.Disabled); GeolocationError error; switch (e.Status) { case GeoPositionStatus.Disabled: error = GeolocationError.Unauthorized; break; case GeoPositionStatus.NoData: error = GeolocationError.PositionUnavailable; break; default: return; } StopListening(); var perror = PositionError; if (perror != null) { perror(this, new PositionErrorEventArgs(error)); } }
void MainGeoWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: if (MainGeoWatcher.Permission == GeoPositionPermission.Denied) { GeoStatus.Text = "Сервис выключен"; } else { GeoStatus.Text = "На этом устройстве сервис недоступен"; } break; case GeoPositionStatus.Initializing: GeoStatus.Text = "Сервис инициализируется"; break; case GeoPositionStatus.NoData: GeoStatus.Text = "Данные о месположении недоступны"; break; case GeoPositionStatus.Ready: GeoStatus.Text = "Данные о местоположении доступны"; break; } }
void Gps_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (StatusChanged != null) { StatusChanged(this, e); } }
private void GeolocatorStatusChanged(object sender, GeoPositionStatusChangedEventArgs args) { EventHandler<GeoPositionStatusChangedEventArgs> gpsStatusChanged = GpsStatusChanged; if (gpsStatusChanged != null) { gpsStatusChanged(sender, args); } }
public void OnLocationFailed(GeoPositionStatusChangedEventArgs e) { var handler = LocationFailed; if (handler != null) { handler(this, e); } }
void WatcherStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { _watcher.Stop(); SetLocalLocation(_watcher.Position.Location); } }
/// <summary> /// Raises the <see cref="E:StatusChanged" /> event. /// </summary> /// <param name="e">The <see cref="System.Device.Location.GeoPositionStatusChangedEventArgs" /> instance containing the event data.</param> protected override void OnStatusChanged(GeoPositionStatusChangedEventArgs e) { var eventHandler = StatusChanged; if (eventHandler != null) { eventHandler(this, e); } }
private void GeoCoordinateWatcherStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { var co = this.watcher.Position.Location; this.latitude = co.Latitude.ToString("0.000"); this.longitude = co.Longitude.ToString("0.000"); this.watcher.Stop(); } }
private void Watcher_StatusChanged( object sender, GeoPositionStatusChangedEventArgs e ) { if( e.Status == GeoPositionStatus.Ready ) { var geoCoordinate = _watcher.Position.Location; LatitudeField.Text = geoCoordinate.Latitude.ToString( "0.000" ); LongitudeField.Text = geoCoordinate.Longitude.ToString( "0.000" ); _watcher.Stop(); } }
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; } }
private void WatcherOnStatusChanged (object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.NoData: this.tcs.TrySetException (new GeolocationException (GeolocationError.PositionUnavailable)); break; case GeoPositionStatus.Disabled: this.tcs.TrySetException (new GeolocationException (GeolocationError.Unauthorized)); break; } }
void GeoCoordinateWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: ModuleManagerFactoryPool.getDataManager().StartAddData("GPS", "Location Service is not enabled on the device"); break; case GeoPositionStatus.NoData: ModuleManagerFactoryPool.getDataManager().StartAddData("GPS", "The Location Service is working, but it cannot get location data"); break; } }
private void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: MessageBox.Show("Location service is disabled or unsupported on this device."); disposeWatcher(); break; case GeoPositionStatus.NoData: MessageBox.Show("Unable to get location data."); disposeWatcher(); break; } }
// Raise the Done event private void NotifyDone(GeoPositionStatusChangedEventArgs e) { if (Done != null) { IaLocationEventArgs locationArgs = null; if (e.Status == GeoPositionStatus.Ready && locationStr != null && locationStr.Length > 0) { locationArgs = new IaLocationEventArgs(locationStr); } Done(this, locationArgs); } }
private void Watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { Debug.WriteLine("Watcher_StatusChanged ({0})", e.Status); switch (e.Status) { case GeoPositionStatus.Disabled: _currentLocation = null; break; case GeoPositionStatus.NoData: _currentLocation = null; break; } }
private void OnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch(e.Status) { case GeoPositionStatus.NoData: OnPositionAvailable(new GeoPosition<GeoCoordinate>(DateTime.Now, GeoCoordinate.Unknown)); _geoWatcher.Stop(); break; case GeoPositionStatus.Ready: OnPositionAvailable(_geoWatcher.Position); break; default: break; } _geoWatcher.Stop(); }
void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { Point point = new Point(0, 0); switch (e.Status) { case GeoPositionStatus.Disabled: if (watcher.Permission == GeoPositionPermission.Denied) { MessageBox.Show("you turn off real-time location service functionality, application will show data from your last position", "ATTENTION", MessageBoxButton.OK); //point = SettingHelper.GetKeyValue<Point>("DefaultLocation"); //App.Latitude = point.X; //App.Longitude = point.Y; //LOAD DATA vm.Load(true, App.lat, App.lon, App.alt); } break; case GeoPositionStatus.Initializing: break; case GeoPositionStatus.NoData: //LOAD DATA break; case GeoPositionStatus.Ready: App.lat = watcher.Position.Location.Latitude; App.lon = watcher.Position.Location.Longitude; App.alt = watcher.Position.Location.Altitude; //LOAD DATA vm.Load(true, App.lat, App.lon, App.alt); //watcher.Stop(); break; } }
protected override void OnStatusChanged(GeoPositionStatusChangedEventArgs e) { try { CheckCurrentState(); _ready = e.Status == GeoPositionStatus.Ready; CheckForLocationAvailable(); } catch (Exception ex) { Stop(); _actionToExecute(null, ex); } }
/// <summary> /// MyStatusChanged /// </summary> private void MyStatusChanged(GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.Disabled: case GeoPositionStatus.NoData: case GeoPositionStatus.Ready: // Stop watch location gcWatcher.Stop(); // Notify NotifyDone(e); break; case GeoPositionStatus.Initializing: default: break; } }
private void gcw_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { //throw new NotImplementedException(); if (e.Status == GeoPositionStatus.Ready) { GeoCoordinate coord = gcw.Position.Location; latitude.Text = "Latitude: " + coord.Latitude.ToString("0.000"); longitude.Text = "Longitude: " + coord.Longitude.ToString("0.000"); //After you have the location, stop the service to conserve power gcw.Stop(); } if (e.Status == GeoPositionStatus.Disabled || e.Status == GeoPositionStatus.NoData) { latitude.Text = "GPS Disabled"; longitude.Text = ""; gcw.Stop(); } }