Exemplo n.º 1
0
        /// <summary>
        /// Called when the current location has changed.
        /// </summary>
        private void OnLocationChanged()
        {
            if (LocationChanged == null)
            {
                return;
            }

            var value = new LocationChangedEventArgs(GetCurrentLocation());

            // Must be thread-safe, dispatch
            if (Dispatcher != null)
            {
                Dispatcher.BeginInvoke(() => LocationChanged(this, value));
            }
            else
            {
                // If no dispatcher is available, trust the user of this service
                LocationChanged(this, value);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the current location has changed.
        /// </summary>
        private void OnLocationChanged()
        {
            if (LocationChanged == null)
            {
                return;
            }

            var currentLocation = GetCurrentLocation();
            var value = new LocationChangedEventArgs(currentLocation);

            // Must be thread-safe, dispatch
            if (Dispatcher != null)
            {
                Dispatcher.BeginInvoke(() => LocationChanged(this, value));
            }
            else
            {
                // If no dispatcher is available, trust the user of this service
                LocationChanged(this, value);
            }
        }