Exemplo n.º 1
0
        public override void UpdatedLocation(CLLocationManager manager, CLLocation newLocation, CLLocation oldLocation)
        {
            Console.WriteLine("New location data = {0}", newLocation.Description());

            _locationHelper.Locations.Insert(0, newLocation);
            _locationHelper.LocationObjects.Insert(0, newLocation.Description());

            _locationHelper.RaiseLocationObjectAdded();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Этот метод можно вызывать если известно что пользователь разрешил определение его местоположения
        /// </summary>
        private void StartRegionUpdates()
        {
            // работа
            CLLocationCoordinate2D workCenter = new CLLocationCoordinate2D(59.938396, 30.264938);

            // Кировский завод
            CLLocationCoordinate2D homeCenter = new CLLocationCoordinate2D(59.875316, 30.267856);

            CLRegion[] regions = new CLRegion[]
            {
                new CLRegion(workCenter, 100, "work100"),
                new CLRegion(workCenter, 200, "work200"),
                new CLRegion(workCenter, 300, "work300"),
                new CLRegion(workCenter, 400, "work400"),
                new CLRegion(workCenter, 500, "work500"),
                new CLRegion(workCenter, 600, "work600"),
                new CLRegion(workCenter, 700, "work700"),
                new CLRegion(workCenter, 800, "work800"),
                new CLRegion(workCenter, 900, "work900"),
                new CLRegion(workCenter, 1000, "work1000"),

                // дом
                new CLRegion(homeCenter, 100, "home100"),
                new CLRegion(homeCenter, 200, "home200"),
                new CLRegion(homeCenter, 300, "home300"),
                new CLRegion(homeCenter, 400, "home400"),
                new CLRegion(homeCenter, 500, "home500"),
                new CLRegion(homeCenter, 600, "home600"),
                new CLRegion(homeCenter, 700, "home700"),
                new CLRegion(homeCenter, 800, "home800"),
                new CLRegion(homeCenter, 900, "home900"),
                new CLRegion(homeCenter, 1000, "home1000")
            };
            // работа

            foreach (CLRegion r in regions)
            {
                _locationHelper.StartRegionUpdates(r);
                _locationHelper.LocationObjects.Insert(0, string.Format("start region updates: {0}", r.Identifier));
                _locationHelper.RaiseLocationObjectAdded();
            }
        }