TryStartGps() private method

Attempts the start the geowatcher.
private TryStartGps ( ) : void
return void
示例#1
0
        private static void OnIsEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GpsLayer layer = d as GpsLayer;

            if (!(bool)e.NewValue)
            {
                if (layer.GeoPositionWatcher != null)
                {
                    layer.GeoPositionWatcher.Stop();
                }
            }
            else
            {
                layer.TryStartGps();
            }
        }
示例#2
0
        private static void GeoPositionWatcherPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GpsLayer layer = d as GpsLayer;

            if (e.OldValue != null)
            {
                layer.DetachListeners(e.OldValue as IGeoPositionWatcher <GeoCoordinate>);
            }
            if (e.NewValue != null)
            {
                layer.AttachListeners(e.NewValue as IGeoPositionWatcher <GeoCoordinate>);
                if (layer.IsInitialized && layer.IsEnabled)
                {
                    layer.TryStartGps();
                }
            }
        }