Esempio n. 1
0
        public MapPage(PetModel petSelected)
        {
            InitializeComponent();
            // aqui aparece el punto guardado
            MapPet.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(petSelected.Latitude, petSelected.Longitude),
                    Distance.FromMiles(.5)
                    ));

            string imagePath = new ImageService().SaveImageFromBase64(petSelected.ImageBase64);

            petSelected.ImageBase64 = imagePath;
            MapPet.Pet = petSelected;
            //añadir el punto en el mapa
            MapPet.Pins.Add(
                new Pin
            {
                Type     = PinType.Place,
                Label    = petSelected.Name,
                Position = new Position(
                    petSelected.Latitude, petSelected.Longitude)
            }
                );

            Name.Text      = petSelected.Name;
            BirthDate.Text = petSelected.BirthDate.ToShortDateString();
            Comments.Text  = petSelected.Comments;
        }
        public MapPage(UserModel userSelected, TripModel tripSelected)
        {
            InitializeComponent();
            //Application.Current.MainPage.DisplayAlert("¡AAAAAAAA!", "AAAAAAAAAAAAAAAAAAAA", "Ok");
            trip = tripSelected;

            MapPet.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(Double.Parse(userSelected.CurrentLocation.Latitude), Double.Parse(userSelected.CurrentLocation.Longitude)),
                    Distance.FromMiles(.5)
                    ));

            string imagePath = new ImageService().SaveImageFromBase64(userSelected.Picture, userSelected.Id);

            userSelected.PicturePath = imagePath;
            MapPet.User = userSelected;
            MapPet.Trip = tripSelected;

            MapPet.Pins.Add(
                new Pin
            {
                Type     = PinType.Place,
                Label    = userSelected.Name,
                Position = new Position(Double.Parse(userSelected.CurrentLocation.Latitude), Double.Parse(userSelected.CurrentLocation.Longitude))
            }
                );

            Name.Text  = userSelected.Name;
            Age.Text   = userSelected.LicensePlate;
            Notes.Text = userSelected.Password;
            timerFlag  = true;
            TimerEventProcessor(userSelected);
        }
Esempio n. 3
0
        public PetMapPage(PetModel petSelected)
        {
            InitializeComponent();

            MapPet.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(petSelected.Latitude, petSelected.Longitude),
                    Distance.FromMiles(.5)
                    ));

            string imagePath = new ImageService().SaveImageFromBase64(petSelected.ImageBase64, petSelected.Id);

            petSelected.ImageBase64 = imagePath;
            MapPet.Pet = petSelected;

            MapPet.Pins.Add(
                new Pin
            {
                Type     = PinType.Place,
                Label    = petSelected.Name,
                Position = new Position(petSelected.Latitude, petSelected.Longitude)
            }
                );

            Name.Text  = petSelected.Name;
            Age.Text   = (DateTime.Now.Year - petSelected.BornDate.Year).ToString() + " años";
            Notes.Text = petSelected.Notes;
        }
        public PetsMap(PetModel petSelected)
        {
            InitializeComponent();
            MapPet.PetList          = null;
            petSelected.ImageBase64 = new ImageService().SaveImageFromBase64(petSelected.ImageBase64, petSelected.ID);
            MapPet.Pet = petSelected;

            MapPet.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(petSelected.Latitud, petSelected.Longitud), Distance.FromKilometers(10)
                    ));

            MapPet.Pins.Add(
                new Pin
            {
                Type     = PinType.Place,
                Label    = petSelected.Nombre,
                Position = new Position(petSelected.Latitud, petSelected.Longitud)
            }
                );
        }
        public PetsMap(List <PetModel> Pets)
        {
            InitializeComponent();
            MapPet.Pet     = null;
            MapPet.PetList = Pets;
            if (Pets.Count != 0)
            {
                double mediaLat = 0;
                double mediaLon = 0;
                foreach (var item in Pets)
                {
                    item.ImageBase64 = new ImageService().SaveImageFromBase64(item.ImageBase64, item.ID);
                    MapPet.Pins.Add(
                        new Pin()
                    {
                        Type     = PinType.Place,
                        Label    = item.Nombre,
                        Position = new Position(item.Latitud, item.Longitud)
                    });
                    mediaLat += item.Latitud;
                    mediaLon += item.Longitud;
                }

                mediaLat /= Pets.Count;
                mediaLon /= Pets.Count;

                MapPet.MoveToRegion(
                    MapSpan.FromCenterAndRadius(
                        new Position(mediaLat, mediaLon), Distance.FromKilometers(10)
                        ));
            }
            else
            {
                MapPet.MoveToRegion(
                    MapSpan.FromCenterAndRadius(
                        new Position(0, 0), Distance.FromKilometers(10)
                        ));
            }
        }