/// <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.Invoke(sender, new PositionErrorEventArgs(GeolocationError.Unauthorized));
                break;

            case PositionStatus.Initializing:
                break;

            case PositionStatus.NoData:
                PositionError.Invoke(sender, new PositionErrorEventArgs(GeolocationError.PositionUnavailable));
                break;

            case PositionStatus.NotInitialized:
                IsListening = false;
                break;

            case PositionStatus.Ready:
                IsListening = true;
                break;
            }
        }
        async void WatcherOnStatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            isEnabled = (watcher.Permission == GeoPositionPermission.Granted && 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;
            }

            await StopListeningAsync();

            PositionError?.Invoke(this, new PositionErrorEventArgs(error));
        }
        /// <inheritdoc/>
        private async void OnListenerPositionError(object sender, PositionErrorEventArgs e)
        {
            await StopListeningAsync();

            PositionError?.Invoke(this, e);
        }
 private void OnPositionError(PositionErrorEventArgs e) => PositionError?.Invoke(this, e);
Exemplo n.º 5
0
        /// <summary>
        /// Handles the <see cref="E:PositionError" /> event.
        /// </summary>
        /// <param name="e">The <see cref="PositionErrorEventArgs"/> instance containing the event data.</param>
        private void OnPositionError(PositionErrorEventArgs e)
        {
            StopListening();

            PositionError?.Invoke(this, e);
        }
        async void OnPositionError(PositionErrorEventArgs e)
        {
            await StopListeningAsync();

            PositionError?.Invoke(this, e);
        }
 /// <summary>
 /// A protected method that is called when <see cref="PositionError"/> should fire
 /// </summary>
 /// <param name="eventArgs">A <see cref="PositionErrorEventArgs"/> object representing the event arguments</param>
 protected void OnPositionError(PositionErrorEventArgs eventArgs)
 {
     PositionError?.Invoke(this, eventArgs);
 }
Exemplo n.º 8
0
 protected virtual void OnPositionError(PositionErrorEventArgs e)
 => PositionError?.Invoke(this, e);