Beispiel #1
0
        public MapDetailView()
        {
            this.WhenActivated(d =>
            {
                this.WireUpControls();
                MapPosition.OnCreate(savedInstanceState);
                MapPosition.OnResume();
                MapsInitializer.Initialize(this);
                MapPosition.GetMapAsync(this);

                d(this.WhenAny(v => v.ViewModel.CurrentCoordinates, x => x.Value).Where(v => v != null).Subscribe(center =>
                {
                    LatLng location = new LatLng(center.Latitude, center.Longitude);
                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(location);
                    builder.Zoom(18);
                    if (center.Heading > -1)
                    {
                        builder.Bearing((float)center.Heading / 360.0f);
                    }
                    builder.Tilt(65);
                    CameraPosition cameraPosition = builder.Build();
                    CameraUpdate cameraUpdate     = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                    map.MoveCamera(cameraUpdate);

                    MarkerOptions myPosition = new MarkerOptions();
                    myPosition.SetPosition(location);
                    myPosition.SetTitle("Aqui estamos!");
                    map.AddMarker(myPosition);
                }));
            });
        }