Ejemplo n.º 1
0
        public override void OnNavigatedTo(INavigationParameters parameters)
        {
            if (parameters.TryGetValue(Constants.NavigationParameters.PinSettings, out PinModel pin))
            {
                CurrentPin        = pin.ToViewModel();
                _updatePin        = true;
                ToolbarButtonText = AppResources.Update;
                MapCameraPosition = new CameraPosition(new Position(CurrentPin.Latitude, CurrentPin.Longitude), 5);
                Pins.Add(CurrentPin.ToPin());
            }
            else
            {
                CurrentPin = new PinViewModel()
                {
                    Name        = string.Empty,
                    UserID      = App.CurrentUserId,
                    Latitude    = 1.3541171,
                    Longitude   = 103.8659237,
                    IsFavorite  = true,
                    Description = string.Empty
                };

                MapCameraPosition = new CameraPosition(new Position(CurrentPin.Latitude, CurrentPin.Longitude), 5);
                Pins.Add(CurrentPin.ToPin());
            }
        }
Ejemplo n.º 2
0
        private void OnDeletePinImageCommand()
        {
            if (!string.IsNullOrEmpty(CurrentPin.ImagePath))
            {
                CurrentPin.ImagePath = string.Empty;

                Pins.Clear();
                Pins.Add(CurrentPin.ToPin());
            }
        }
Ejemplo n.º 3
0
        private void OnMapClickedCommand(Position point)
        {
            var lat = point.Latitude;
            var lng = point.Longitude;

            CurrentPin.Latitude  = lat;
            CurrentPin.Longitude = lng;

            var newPin = CurrentPin.ToPin();

            Pins.Clear();
            Pins.Add(newPin);
        }
Ejemplo n.º 4
0
        private async Task OnChangeOrAddImageCommand()
        {
            PickMediaOptions options = new PickMediaOptions();

            options.CustomPhotoSize = 6;
            options.PhotoSize       = PhotoSize.Custom;

            var file = await CrossMedia.Current.PickPhotoAsync(options);

            if (file != null)
            {
                CurrentPin.ImagePath = file.Path;

                Pins.Clear();
                Pins.Add(CurrentPin.ToPin());
            }
        }