Beispiel #1
0
        public MapDetailView() : base("MapDetailView", null)
        {
            this.WhenActivated(d =>
            {
                d(this.WhenAny(v => v.ViewModel.IsLoading, x => x.Value).Subscribe(loading =>
                {
                    LoadingRing.Hidden = !loading;
                }));

                d(this.WhenAny(v => v.ViewModel.CurrentCoordinates, x => x.Value).Where(v => v != null).Subscribe(center =>
                {
                    var coordinate = new CLLocationCoordinate2D(center.Latitude, center.Longitude);
                    MapPosition.AddAnnotations(new MKPointAnnotation()
                    {
                        Title      = "Aqui estamos!",
                        Coordinate = coordinate
                    });
                    MapPosition.SetCamera(new MKMapCamera()
                    {
                        CenterCoordinate = coordinate,
                        Heading          = center.Heading < 0 ? 0 : center.Heading,
                        Altitude         = 75,
                        Pitch            = 75
                    }, true);
                }));

                ViewModel.GetCurrentCoordinatesCommand.Execute(null);
            });
        }