예제 #1
0
        public MapPageCS()
        {
            var customMap = new CustomMap {
                MapType = MapType.Street,
                WidthRequest = App.ScreenWidth,
                HeightRequest = App.ScreenHeight
            };

            var pin = new CustomPin {
                Pin = new Pin {
                    Type = PinType.Place,
                    Position = new Position (37.79752, -122.40183),
                    Label = "Xamarin San Francisco Office",
                    Address = "394 Pacific Ave, San Francisco CA"
                },
                Id = "Xamarin",
                Url = "http://xamarin.com/about/"
            };

            customMap.CustomPins = new List<CustomPin> { pin };
            customMap.Pins.Add(pin.Pin);
            customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(37.79752, -122.40183), Distance.FromMiles(1.0)));

            Content = customMap;
        }
예제 #2
0
        public MapPage()
        {
            InitializeComponent();

            //customMap.IsShowingUser = true;
            //requestGPSAsync();
            // ArrayList<tipoDato> = new;
            var datoOcupacion           = obtenerDatosOcupacion();
            var datosResultadoOcupacion = JArray.Parse(datosOcupacion);
            //findMe();
            string estadoletra = "";
            bool   estadoBool;
            ///////////////////////////////////////////////////

            //////////////////////////

            int counter = 0;

            Title = "Stores";
            Icon  = "flag_map_marker4.png";


            var customMap = new CustomMap
            {
                MapType       = MapType.Street,
                WidthRequest  = App.ScreenWidth,
                HeightRequest = App.ScreenHeight
            };

            customMap.CustomPins = new List <CustomPin>();

            foreach (var v in datosResultadoOcupacion)
            {
                if ((int)datosResultadoOcupacion[counter]["estado"] == 1)
                {
                    estadoBool  = false;
                    estadoletra = "Ocupado";
                }
                else
                {
                    estadoBool  = true;
                    estadoletra = "Desocupado";
                }
                var pin = new CustomPin()
                {
                    Pin = new Pin()
                    {
                        Type     = PinType.Place,
                        Position = new Position((double)datosResultadoOcupacion[counter]["coordenadas_lat"], (double)datosResultadoOcupacion[counter]["coordenadas_lon"]),
                        Label    = estadoletra,
                        Address  = "Calle " + datosResultadoOcupacion[counter]["calle"].ToString() + " con " + datosResultadoOcupacion[counter]["interseccion1"].ToString()
                    },
                    Id     = "id: " + counter,
                    Url    = "",
                    Estado = estadoBool
                };
                customMap.CustomPins.Add(pin);
                counter++;
            }
            foreach (var pin in customMap.CustomPins)
            {
                customMap.Pins.Add(pin.Pin);
            }
            // dont delete below code ,they will save you if timer doesnt work .

            customMap.MoveToRegion(MapSpan.FromCenterAndRadius(customMap.CustomPins [0].Pin.Position, Distance.FromMiles(0.20)));
            Content = customMap;
        }