Esempio 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());
            }
        }
Esempio n. 2
0
 public void Dropped()
 {
     if (_triggerPin && _triggerPin.IsValidPin(this))
     {
         CurrentPin.RemoveRing(this);
         CurrentPin = _triggerPin;
     }
     state.ChangeMoveState(State.dropped);
 }
Esempio n. 3
0
        private void OnDeletePinImageCommand()
        {
            if (!string.IsNullOrEmpty(CurrentPin.ImagePath))
            {
                CurrentPin.ImagePath = string.Empty;

                Pins.Clear();
                Pins.Add(CurrentPin.ToPin());
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
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());
            }
        }
Esempio n. 6
0
        private async Task OnAddOrSaveClickedCommand()
        {
            var pinModel = await _pinService.FindPinModelAsync(Pins.LastOrDefault());

            CurrentPin.CategoryID = -1;

            if (pinModel != null)
            {
                CurrentPin.ID = pinModel.ID;
                await _pinService.SaveOrUpdatePinAsync(CurrentPin.ToModel());
            }
            else
            {
                await _pinService.SaveOrUpdatePinAsync(CurrentPin.ToModel());
            }

            await NavigationService.GoBackAsync();
        }