Exemplo n.º 1
0
        private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            System.Diagnostics.Debug.WriteLine("Location position changed {0} {1}", e.Position.Location.Latitude, e.Position.Location.Longitude);
            GeoCoordinate coord = e.Position.Location;

            if (coord.IsUnknown != true)
            {
                String cityToken = Calender2.Data.CityData.FindClosestCity(coord.Latitude, coord.Longitude);
                City   city      = Calender2.Data.CityData.GetCityInformation(cityToken);
                UpdateCityTokenAndGetData(cityToken, city._Name, city._timeZone);
                DayView.UpdateDayViewPageForNewCity();
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Location services not initilaized");
            }
        }
Exemplo n.º 2
0
        private void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            GeoCoordinateWatcher watcher = sender as GeoCoordinateWatcher;

            System.Diagnostics.Debug.WriteLine("Location services status" + watcher.Status.ToString());
            if (e.Status == GeoPositionStatus.Ready)
            {
                GeoCoordinate coord = watcher.Position.Location;
                if (coord.IsUnknown != true)
                {
                    String cityToken = Calender2.Data.CityData.FindClosestCity(coord.Latitude, coord.Longitude);
                    City   city      = Calender2.Data.CityData.GetCityInformation(cityToken);
                    UpdateCityTokenAndGetData(cityToken, city._Name, city._timeZone);
                    DayView.UpdateDayViewPageForNewCity();
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Location services not initilaized");
                }
            }
        }