Inheritance: IStatusChangedEventArgs
Exemplo n.º 1
0
 void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (args.Status.Equals(PositionStatus.Ready))
     {
        
     }
 }
        private async void MyGeo_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            // use the dispatcher with lambda fuction to update the UI thread.
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // code to run in method to update UI
                switch (args.Status)
                {
                    case PositionStatus.Ready:
                        // what here?
                        statusUpdates.Text = "Locations services normal";
                        ready = true;
                        break;
                    case PositionStatus.Disabled:
                        statusUpdates.Text = "Turn on location services";
                        ready = false;
                        break;
                    case PositionStatus.NoData:
                        statusUpdates.Text = "No data received from Location services";
                        ready = false;
                        break;
                    case PositionStatus.Initializing:
                        statusUpdates.Text = "Initialising Location services";
                        ready = false;
                        break;
                    default:
                        statusUpdates.Text = "Unknown problem with your location services";
                        ready = false;
                        break;
                }

            });

        }
Exemplo n.º 3
0
 async void location_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         StatusValue.Text = args.Status.ToString();
     });
 }
        private void OnStatusChanged(Geolocator geolocator, StatusChangedEventArgs args)
        {
            switch (args.Status)
            {
                case PositionStatus.Ready:
                    break;

                case PositionStatus.Initializing:
                    break;

                case PositionStatus.NoData:
                    // TODO - trace could be useful here?
                    SendError(MvxLocationErrorCode.PositionUnavailable);
                    break;

                case PositionStatus.Disabled:
                    // TODO - trace could be useful here?
                    SendError(MvxLocationErrorCode.ServiceUnavailable);
                    break;

                case PositionStatus.NotInitialized:
                    // TODO - trace could be useful here?
                    SendError(MvxLocationErrorCode.ServiceUnavailable);
                    break;

                case PositionStatus.NotAvailable:
                    // TODO - trace could be useful here?
                    SendError(MvxLocationErrorCode.ServiceUnavailable);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 5
0
        void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            Debug.WriteLine("StatusChanged: " + args.Status);

            switch (args.Status)
            {
                case PositionStatus.NotInitialized:
                    // 初期化前の状態。GetGeopositionAsyncメソッドを実行していないか
                    // PositionChangedイベントハンドラが設定されていない状態です。
                    break;

                case PositionStatus.Initializing:
                    // 初期化中の状態。
                    break;

                case PositionStatus.Ready:
                    // 位置情報を扱える状態。
                    break;

                case PositionStatus.NoData:
                    // どのロケーションプロバイダーのどの位置情報も使えない状態。
                    // GetGeopositionAsyncメソッドを実行した直後か
                    // PositionChangedイベントハンドラが設定されている状態で、
                    // 位置情報が扱えるようになるとReadyへ状態遷移します。
                    break;

                case PositionStatus.Disabled:
                    // ユーザーが「位置情報」にアクセスする許可を与えていない状態。
                    break;
            }
        }
Exemplo n.º 6
0
 private static async void Locator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (Dispatcher == null) return;
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
     {
         OnLocationChanged();
     });
 }
Exemplo n.º 7
0
 private async void GeoLocatorStatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (args.Status != PositionStatus.Initializing &&
         args.Status != PositionStatus.Ready)
     {
         await dispatcher.RunAsync(CoreDispatcherPriority.Low, () => Location = null);
     }
 }
Exemplo n.º 8
0
 private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     string status = args.Status.ToString();
     if (StatusChanged != null)
     {
         StatusChanged(this, new LocatorStatusChangedEventArgs(WrapPositionStatus(args.Status)));
     }
 }
Exemplo n.º 9
0
        private async void OnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status = string.Empty;
            switch (args.Status)
            {
                case PositionStatus.Ready:
                    // Location platform is providing valid data.
                    Debug.WriteLine("Location platform is ready.");
                    status = "Location platform is ready.";
                    break;

                case PositionStatus.Initializing:
                    // Location platform is attempting to acquire a fix. 
                    Debug.WriteLine("Location platform is attempting to obtain a position.");
                    status = "Location platform is attempting to obtain a position.";
                    break;

                case PositionStatus.NoData:
                    // Location platform could not obtain location data.
                    Debug.WriteLine("Not able to determine the location.");
                    status = "Not able to determine the location.";
                    break;

                case PositionStatus.Disabled:
                    // The permission to access location data is denied by the user or other policies.
                    Debug.WriteLine("Access to location is denied.");
                    status = "Access to location is denied.";
                    break;

                case PositionStatus.NotInitialized:
                    // The location platform is not initialized. This indicates that the application 
                    // has not made a request for location data.
                    Debug.WriteLine("No request for location is made yet.");
                    status = "No request for location is made yet.";
                    break;

                case PositionStatus.NotAvailable:
                    // The location platform is not available on this version of the OS.
                    Debug.WriteLine("Location is not available on this version of the OS.");
                    status = "Location is not available on this version of the OS.";
                    break;

                default:
                    Debug.WriteLine("Error - Status has fallen thorugh");
                    status = "Error - Status has fallen thorugh";
                    break;
            }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                txtStatus.Text = status;
            });

        }
Exemplo n.º 10
0
  private void Geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args) {
     try {
         statusLabel.Text = GetStatusString(geolocator.LocationStatus);
     } catch (System.UnauthorizedAccessException) {
         statusLabel.Text = "No data";
     } catch (TaskCanceledException) {
         statusLabel.Text = "Cancelled";
     } catch (Exception ex) {
         statusLabel.Text = ex.Message;
     }
 }
Exemplo n.º 11
0
 private async void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (args.Status == PositionStatus.Ready)
     {
         geolocator.DesiredAccuracy = PositionAccuracy.High;
         geolocator.DesiredAccuracyInMeters = 100;
         var location = await geolocator.GetGeopositionAsync();
         map.Center = new Bing.Maps.Location(location.Coordinate.Point.Position.Latitude, 
                                             location.Coordinate.Point.Position.Longitude);
     }
 }
 private async void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (args.Status == PositionStatus.Ready)
     {
         var position = await geolocator.GetGeopositionAsync();
         path.Update(position.Coordinate.Latitude, position.Coordinate.Longitude);
         await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             GPSSpinner.IsActive = false;
             GPSSpinnerLabel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
             RecordButton.IsEnabled = true;
         });
     }
 }
Exemplo n.º 13
0
 private void Locator_StatusChanged( Geolocator sender, StatusChangedEventArgs args )
 {
     switch ( args.Status )
     {
         case PositionStatus.Disabled:
         case PositionStatus.NoData:
         case PositionStatus.NotAvailable:
             OnError();
             break;
         case PositionStatus.Ready:
             OnReady();
             break;
     }
 }
Exemplo n.º 14
0
 void watcher_StatusChanged(Geolocator sender, StatusChangedEventArgs eventArgs)
 {
     switch (eventArgs.Status)
     {
         case PositionStatus.Disabled:
             setStatus(OUT_OF_SERVICE);
             break;
         case PositionStatus.Initializing:
         case PositionStatus.NoData:
             setStatus(TEMPORARILY_UNAVAILABLE);
             break;
         case PositionStatus.Ready:
             setStatus(AVAILABLE);
             break;
     }
 }
Exemplo n.º 15
0
 private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     switch (args.Status)
     {
         case PositionStatus.Ready:
         case PositionStatus.Initializing:
         case PositionStatus.NoData:
             IsLocationEnabled = true;
             break;
         case PositionStatus.NotInitialized:
             break;
         case PositionStatus.Disabled:
         case PositionStatus.NotAvailable:
             IsLocationEnabled = false;
             break;
     }
 }
Exemplo n.º 16
0
 void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     locationEnabled = false;
     switch (args.Status)
     {
         case Windows.Devices.Geolocation.PositionStatus.Ready:
             // Location data is available
             Status = "Location is available.";
             locationEnabled = true;
             break;
         case Windows.Devices.Geolocation.PositionStatus.Initializing:
             // This status indicates that a GPS is still acquiring a fix
             Status =  "A GPS device is still initializing.";
             break;
         case Windows.Devices.Geolocation.PositionStatus.NoData:
             // No location data is currently available
             Status = "Data from location services is currently unavailable.";
             break;
         case Windows.Devices.Geolocation.PositionStatus.Disabled:
             // The app doesn't have permission to access location,
             // either because location has been turned off.
             Status = "Your location is currently turned off. " +
                 "Change your settings through the Settings charm " +
                 " to turn it back on.";
             locationEnabled = false;
             break;
         case Windows.Devices.Geolocation.PositionStatus.NotInitialized:
             // This status indicates that the app has not yet requested
             // location data by calling GetGeolocationAsync() or
             // registering an event handler for the positionChanged event.
             Status = "Location status is not initialized because " +
                           "the app has not requested location data.";
             locationEnabled = false;
             break;
         case Windows.Devices.Geolocation.PositionStatus.NotAvailable:
             // Location is not available on this version of Windows
             Status = "You do not have the required location services " +
                 "present on your system.";
             locationEnabled = false;
             break;
         default:
             Status = "Unknown status";
             break;
     }
     
 }
Exemplo n.º 17
0
        private void OnLocatorStatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            switch (args.Status)
            {
                case PositionStatus.Ready:
                case PositionStatus.Initializing:
                    AccessStatus = LocationAccessStatus.Available;
                    break;
                case PositionStatus.NoData:
                case PositionStatus.NotAvailable:
                case PositionStatus.NotInitialized:
                    AccessStatus = LocationAccessStatus.Unavailable;
                    break;
                default:
                    AccessStatus = LocationAccessStatus.Unknown;
                    break;

            }
        }
Exemplo n.º 18
0
		/// <summary>
		/// Locators the status changed.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="args">The <see cref="StatusChangedEventArgs"/> instance containing the event data.</param>
		private void LocatorStatusChanged(Windows.Devices.Geolocation.Geolocator sender, StatusChangedEventArgs args)
		{
			switch (args.Status)
			{
				case PositionStatus.Disabled:
					PositionError.TryInvoke(sender, new PositionErrorEventArgs(GeolocationError.Unauthorized));
					break;
				case PositionStatus.Initializing:
					break;
				case PositionStatus.NoData:
					PositionError.TryInvoke(sender, new PositionErrorEventArgs(GeolocationError.PositionUnavailable));
					break;
				case PositionStatus.NotInitialized:
					IsListening = false;
					break;
				case PositionStatus.Ready:
					IsListening = true;
					break;
			}
		}
Exemplo n.º 19
0
        void geoLocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status = string.Empty;

            switch (args.Status)
            {
                case PositionStatus.Disabled:
                    // la aplicación no tiene la capacidad adecuada o el gps está apagago
                    status = "La localización está deshabilitada.";
                    break;
                case PositionStatus.Initializing:
                    // la geolocalización comenzó la operación de seguimiento
                    status = "Inicializando";
                    break;
                case PositionStatus.NoData:
                    // el servicio de localización no fue capaz de obtener la ubicación
                    status = "Sin Información";
                    break;
                case PositionStatus.Ready:
                    // el servicio de localización está preparado
                    status = "Preparado";
                    break;
                case PositionStatus.NotAvailable:
                    status = "No Disponible";
                    // no hay ningún hardware capaz de adquirir información de ubicación
                    break;
                case PositionStatus.NotInitialized:
                    // el estado inicial de la geolocalización
                    status = "No Inicializado";
                    break;
            }

            Dispatcher.BeginInvoke(() =>
            {
                tbEstado.Text = status;
            });
        }
Exemplo n.º 20
0
        void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status = "";

            switch (args.Status)
            {
                case PositionStatus.Disabled:
                    // the application does not have the right capability or the location master switch is off
                    status = "Disabled";
                    break;
                case PositionStatus.Initializing:
                    // the geolocator started the tracking operation
                    status = "initializing";
                    break;
                case PositionStatus.NoData:
                    // the location service was not able to acquire the location
                    status = "no data";
                    break;
                case PositionStatus.Ready:
                    // the location service is generating geopositions as specified by the tracking parameters
                    status = "Ready";
                    break;
                case PositionStatus.NotAvailable:
                    status = "NA";
                    // not used in WindowsPhone, Windows desktop uses this value to signal that there is no hardware capable to acquire location information
                    break;
                case PositionStatus.NotInitialized:
                    // the initial state of the geolocator, once the tracking operation is stopped by the user the geolocator moves back to this state
                    status = "NI";
                    break;
            }

            Dispatcher.BeginInvoke(() =>
            {
                statusBox.Text = status;
            });   
        }
Exemplo n.º 21
0
 private void OnStatusChanged(Geolocator geolocator, StatusChangedEventArgs args)
 {
   Dispatcher.BeginInvoke(
     () => Status.Text = args.Status.ToString());
 }
Exemplo n.º 22
0
 private void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     CurrentLocation.Status = LocationHelpers.ConvertLocationStatus(args.Status);
     _fire();
 }
 /// <summary>
 /// Handles the Geolocator.StatusChanged event to refresh the map and locations list 
 /// if the Geolocator is available, and to display an error message otherwise.
 /// </summary>
 private async void Geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     await this.CallOnUiThreadAsync(async () =>
     {
         switch (args.Status)
         {
             case PositionStatus.Ready:
                 this.UpdateLocationStatus(true);
                 await this.ResetViewAsync();
                 break;
             case PositionStatus.Initializing:
                 break;
             case PositionStatus.NoData:
             case PositionStatus.Disabled:
             case PositionStatus.NotInitialized:
             case PositionStatus.NotAvailable:
             default:
                 this.UpdateLocationStatus(false);
                 await this.ResetViewAsync(false);
                 break;
         }
     });
 }
Exemplo n.º 24
0
        private async void MyGeo_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            // use the dispatcher with lambda fuction to update the UI thread.
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // code to run in method to update UI
                switch (args.Status)
                {
                    case PositionStatus.Ready:
                        tblStatusUpdates.Text = (Localization.Get("lsReady"));
                        break;
                    case PositionStatus.Disabled:
                        tblStatusUpdates.Text = (Localization.Get("lsDisabled")); 
                        break;
                    case PositionStatus.NoData:
                        tblStatusUpdates.Text = (Localization.Get("lsNoData"));
                        break;
                    case PositionStatus.Initializing:
                        tblStatusUpdates.Text = (Localization.Get("lsInit"));
                        break;
                    default:
                        tblStatusUpdates.Text = (Localization.Get("lsDef"));
                        break;
                }

            });

        }
Exemplo n.º 25
0
        /// <summary>
        /// Event handler for StatusChanged events. It is raised when the 
        /// location status in the system changes.
        /// </summary>
        /// <param name="sender">Geolocator instance</param>
        /// <param name="e">Statu data</param>
        async private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs e)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                GeolocationPin.Status = e.Status;
                switch (e.Status)
                {
                    case PositionStatus.Ready:
                        // Location platform is providing valid data.
                        ShowStatus("Geolocation is ready", StatusType.Info, 5, 0);
                        break;

                    case PositionStatus.Initializing:
                        // Location platform is attempting to acquire a fix. 
                        ShowStatus("Initializing");
                        break;

                    case PositionStatus.NoData:
                        // Location platform could not obtain location data.
                        ShowStatus("No data", StatusType.Error, 5, 0);
                        break;

                    case PositionStatus.Disabled:
                        // The permission to access location data is denied by the user or other policies.
                        ShowStatus("Disabled", StatusType.Error, 5, 0);

                        // Show message to the user to go to location settings
                        //LocationDisabledMessage.Visibility = Visibility.Visible;

                        // Clear cached location data if any
                        CurrentPosition = null;
                        break;

                    case PositionStatus.NotInitialized:
                        // The location platform is not initialized. This indicates that the application 
                        // has not made a request for location data.
                        ShowStatus("Not initialized");
                        break;

                    case PositionStatus.NotAvailable:
                        // The location platform is not available on this version of the OS.
                        ShowStatus("Not available", StatusType.Error, 5, 0);
                        break;

                    default:
                        ShowStatus("Unknown", StatusType.Error, 5, 0);
                        GeolocationPin.Status = PositionStatus.NoData;
                        break;
                }
            });
        }
        //Als de status van de locatie permissies veranderd is.
        async private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            //TODO: Locatie opvragen afwerken?
            //  https://msdn.microsoft.com/en-us/library/windows/desktop/mt219698.aspx

            /*await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {

            });*/
            Debug.WriteLine("Status Locatie toestemming is veranderd");

            switch (args.Status)
            {
                case PositionStatus.Ready:
                    //We krijgen locatie data binnen
                    //aanmaken Geolocator
                    /*Geolocator geolocator = new Geolocator();

                    //Inschrijven op de StatusChanged voor updates van de permissies voor locaties.
                    geolocator.StatusChanged += OnStatusChanged;

                    //Locatie opvragen
                    Geoposition pos = await geolocator.GetGeopositionAsync();
                    Debug.WriteLine("Positie opgevraagd, lat: " + pos.Coordinate.Point.Position.Latitude + " lon: " + pos.Coordinate.Point.Position.Longitude);

                    //Locatie opslaan als gebruikerslocatie
                    (App.Current as App).UserLocation = pos;*/
                    Debug.WriteLine("Positionstatus Ready");

                    break;
                case PositionStatus.Initializing:
                    Debug.WriteLine("Positionstatus Initializing");
                    break;
                case PositionStatus.Disabled:
                    Debug.WriteLine("Positionstatus Disabled");
                    break;
            }
        }
        private void OnLocatorStatusChanged(Windows.Devices.Geolocation.Geolocator sender, StatusChangedEventArgs e)
        {
            GeolocationError error;
            switch (e.Status)
            {
                case PositionStatus.Disabled:
                    error = GeolocationError.Unauthorized;
                    break;

                case PositionStatus.NoData:
                    error = GeolocationError.PositionUnavailable;
                    break;

                default:
                    return;
            }

            if (this.isListening)
            {
                StopListening();
                OnPositionError(new PositionErrorEventArgs(error));
            }

            this.locator = null;
        }
Exemplo n.º 28
0
 private void OnLocationStatusChanged(Geolocator sender, StatusChangedEventArgs e)
 {
 }
Exemplo n.º 29
0
        private void OnGeolocatorStatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            switch (args.Status)
            {
                case PositionStatus.Disabled:
                    // the application does not have the right capability or the location master switch is off
                    requestedCoordInfo.providerEnabled = false;
                    requestedCoordInfo.isGPSAvailable = false;
                    break;
                case PositionStatus.Initializing:
                    // the geolocator started the tracking operation
                    requestedCoordInfo.providerEnabled = true;
                    requestedCoordInfo.isGPSAvailable = true;
                    break;
                case PositionStatus.NoData:
                    // the location service was not able to acquire the location
                    requestedCoordInfo.isGPSAvailable = false;
                    break;
                case PositionStatus.Ready:
                    // the location service is generating geopositions as specified by the tracking parameters
                    requestedCoordInfo.providerEnabled = true;
                    requestedCoordInfo.isGPSAvailable = true;
                    break;
                case PositionStatus.NotAvailable:
                    // not used in WindowsPhone, Windows desktop uses this value to signal that there is no hardware capable to acquire location information
                    requestedCoordInfo.isGPSAvailable = false;
                    break;
                case PositionStatus.NotInitialized:
                    // the initial state of the geolocator, once the tracking operation is stopped by the user the geolocator moves back to this state
                    break;
            }

            requestedCoordInfo.providerStatus = args.Status;

        }
Exemplo n.º 30
0
 private void GeolocatorStatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     RaiseStatusChanged(args.ToLocationServiceStatusChangedEventArgs());
 }