public override void ViewDidLoad()
        {
            mapView = new MKMapView();
            RectangleF frame = new RectangleF(0,0,320,360);

            mapView.Frame = frame;
            mapView.ShowsUserLocation = true;

            var myAnnotation = new MyAnnotation(new CLLocationCoordinate2D(0,0), "Home", "is where the heart is");
            mapView.AddAnnotationObject(myAnnotation);

            UIButton detailButton = UIButton.FromType(UIButtonType.DetailDisclosure);

            mapView.GetViewForAnnotation = delegate(MKMapView mapViewForAnnotation, NSObject annotation) {

                var anv = mapView.DequeueReusableAnnotation("thislocation");
                if (anv == null)
                {
                    anv = new MKPinAnnotationView(annotation, "thislocation");

                    detailButton.TouchUpInside += (s, e) => {
                        Console.WriteLine ("Tapped");
                    };
                    anv.RightCalloutAccessoryView = detailButton;
                }
                else
                {
                    anv.Annotation = annotation;
                }
                anv.CanShowCallout = true;
                return anv;
            };

            View.AddSubview(mapView);
        }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var map = new MKMapView(new RectangleF(20, 166, 280, 192));

            this.View.Add(map);
            map.ShowsUserLocation = true;
            map.MapType           = MKMapType.Standard;
            map.Delegate          = new MapViewDelegate();

            var location = new CLLocationCoordinate2D(ViewModel.Latitude, ViewModel.Longitude);

            //map.SetCenterCoordinate(location, true);
            map.SetRegion(new MKCoordinateRegion(location, new MKCoordinateSpan(0.1, 0.1)), true);

            var annotation = new MyAnnotation(
                location
                , ViewModel.SharedTextSource.GetText("AppTitle")
                , ViewModel.Name);

            map.AddAnnotationObject(annotation);


            Button1.SetImage(UIImage.FromFile("ConfResources/Images/appbar.link.png"), UIControlState.Normal);
            Button2.SetImage(UIImage.FromFile("ConfResources/Images/appbar.phone.png"), UIControlState.Normal);
            Button3.SetImage(UIImage.FromFile("ConfResources/Images/appbar.feature.email.rest.png"), UIControlState.Normal);

            this.AddBindings(new Dictionary <object, string>()
            {
                { Label1, "{'Text':{'Path':'Name'}}" },
                { Button1, "{'Title':{'Path':'Address'}}" },
                { Button2, "{'Title':{'Path':'Phone'}}" },
                { Button3, "{'Title':{'Path':'Email'}}" },
            });

            this.AddBindings(new Dictionary <object, string>()
            {
                { Button1, "{'TouchDown':{'Path':'WebPageCommand'}}" },
                { Button2, "{'TouchDown':{'Path':'PhoneCommand'}}" },
                { Button3, "{'TouchDown':{'Path':'EmailCommand'}}" },
            });

            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Tweet", UIBarButtonItemStyle.Bordered, (sender, e) => ViewModel.ShareGeneralCommand.Execute()), false);
        }
Exemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var map = new MKMapView(new RectangleF(20, 166, 280, 192));
            this.View.Add(map);
            map.ShowsUserLocation = true;
            map.MapType = MKMapType.Standard;
            map.Delegate = new MapViewDelegate();

            var location = new CLLocationCoordinate2D(ViewModel.Latitude, ViewModel.Longitude);
            //map.SetCenterCoordinate(location, true);
            map.SetRegion(new MKCoordinateRegion(location, new MKCoordinateSpan(0.1, 0.1)), true);

            var annotation = new MyAnnotation(
                                  location
                                  , ViewModel.SharedTextSource.GetText("AppTitle")
                                  , ViewModel.Name);
            map.AddAnnotationObject(annotation);


            Button1.SetImage(UIImage.FromFile("ConfResources/Images/appbar.link.png"), UIControlState.Normal);
            Button2.SetImage(UIImage.FromFile("ConfResources/Images/appbar.phone.png"), UIControlState.Normal);
            Button3.SetImage(UIImage.FromFile("ConfResources/Images/appbar.feature.email.rest.png"), UIControlState.Normal);

            this.AddBindings(new Dictionary<object, string>()
		                         {
                                     {Label1,"Text Name"}, 
                                     {Button1,"Title Address"},
                                     {Button2,"Title Phone"},
                                     {Button3,"Title Email"},
		                         });

            this.AddBindings(new Dictionary<object, string>()
		                         {
                                     {Button1,"TouchUpInside WebPageCommand"},
                                     {Button2,"TouchUpInside PhoneCommand"},
                                     {Button3,"TouchUpInside EmailCommand"},
		                         });

            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Tweet", UIBarButtonItemStyle.Bordered, (sender, e) => ViewModel.DoShareGeneral()), false);
        }
        public override void ViewDidLoad()
        {
            mapView = new MKMapView();
            RectangleF frame = new RectangleF(0, 0, 320, 360);

            mapView.Frame             = frame;
            mapView.ShowsUserLocation = true;


            var myAnnotation = new MyAnnotation(new CLLocationCoordinate2D(0, 0), "Home", "is where the heart is");

            mapView.AddAnnotationObject(myAnnotation);


            UIButton detailButton = UIButton.FromType(UIButtonType.DetailDisclosure);

            mapView.GetViewForAnnotation = delegate(MKMapView mapViewForAnnotation, NSObject annotation) {
                var anv = mapView.DequeueReusableAnnotation("thislocation");
                if (anv == null)
                {
                    anv = new MKPinAnnotationView(annotation, "thislocation");

                    detailButton.TouchUpInside += (s, e) => {
                        Console.WriteLine("Tapped");
                    };
                    anv.RightCalloutAccessoryView = detailButton;
                }
                else
                {
                    anv.Annotation = annotation;
                }
                anv.CanShowCallout = true;
                return(anv);
            };

            View.AddSubview(mapView);
        }