コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            viewModel = new CoffeesViewModel();

            MyButtonLoadData.TouchUpInside += async(sender, args) =>
            {
                MyButtonLoadData.Enabled = false;
                MyMap.RemoveAnnotations(MyMap.Annotations);

                var coffees = await viewModel.GetCoffees();

                foreach (var coffee in coffees)
                {
                    MyMap.AddAnnotation(new MKPointAnnotation
                    {
                        Coordinate = new CLLocationCoordinate2D(coffee.Latitude, coffee.Longitude),
                        Title      = coffee.Name
                    });
                }

                MyButtonLoadData.Enabled = true;
            };


            ZoomToSeattle();
        }
コード例 #2
0
        async partial void MyButtonPin_TouchUpInside(UIButton sender)
        {
            var center = MyMap.Region.Center;

            var title = await viewModel.GetNameForLocation(center.Latitude, center.Longitude);

            MyMap.AddAnnotation(new MKPointAnnotation
            {
                Coordinate = center,
                Title      = title
            });
        }
コード例 #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var coords = new CoreLocation.CLLocationCoordinate2D(Latitude, Longitude);

            SetMapToCoordinate(coords);

            Title = PinTitle;
            var pin = new BasicPinAnnotation(coords, PinTitle, PinSubtitle);

            MyMap.AddAnnotation(pin);
        }
コード例 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            try
            {
                var latitude  = ViewModel.Latitude;
                var longitude = ViewModel.Longitude;
                var coords    = new CLLocationCoordinate2D(latitude ?? 0, longitude ?? 0);

                SetMapToCoordinate(coords);

                Title = ViewModel.Title;
                var pin = new BasicPinAnnotation(coords, ViewModel.Title, ViewModel.Subtitle);
                MyMap.AddAnnotation(pin);
            }
            catch (Exception)
            {
            }
        }
コード例 #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var vm = NavigationParameter as CoffeeMapViewModel;

            if (vm == null)
            {
                return;
            }

            Record record = vm.Record;

            if (record == null)
            {
                return;
            }

            if (record.geometry == null || record.geometry.coordinates == null)
            {
                return;
            }

            try
            {
                var recordCoordinates = record.geometry.coordinates;
                var latitude          = recordCoordinates[1];
                var longitude         = recordCoordinates[0];
                var coords            = new CLLocationCoordinate2D(latitude, longitude);

                SetMapToCoordinate(coords);

                Title = record.fields.nom_du_cafe;
                var pin = new BasicPinAnnotation(coords, record.fields.nom_du_cafe, record.fields.adresse);
                MyMap.AddAnnotation(pin);
            }
            catch (Exception)
            {
            }
        }