Пример #1
0
        private AppContextLiveData() : base()
        {
            _locationProvider = new GpsLocationProvider();
            _compassProvider  = new CompassProvider();

            _locationTimer = new System.Timers.Timer();

            _locationTimer.Interval = 3000;
            _locationTimer.Elapsed += OnLocationTimerElapsed;

            _compassProvider.OnHeadingChanged = OnHeadingChanged;
        }
Пример #2
0
        public static async Task <PoiCountry?> GetDefaultCountryByPhoneLocation()
        {
            PoiCountry?defaultCountry = null;
            var        location       = await GpsLocationProvider.GetLastKnownLocationAsync();

            if (location != null)
            {
                var placeInfo = await PlaceNameProvider.AsyncGetPlaceName(location);

                defaultCountry = placeInfo?.Country;
            }

            if (!defaultCountry.HasValue)
            {
                defaultCountry = PoiCountryHelper.GetDefaultCountryByPhoneSettings();
            }

            return(defaultCountry);
        }