Ejemplo n.º 1
0
        private async void SavePost()
        {
            Post post = null;

            if (IsNewPostMode)
            {
                var answer = await _dialogService.DisplayAlertAsync("Création d'un enregistrement", "Voulez-vous vraiment creer cette enregristrement ?", "Valider", "Annuler");

                if (answer == true)
                {
                    var position = await _geolocationService.GetCurrentPosition();

                    var adresse = await _geolocationService.GetAdresseFromPosition(position);

                    post = new Post(Name, Description, SelectedTags, ImagePath, position.Latitude, position.Longitude, adresse, DateTime.Now);
                    _postService.CreatePost(post);
                }
            }
            else
            {
                var answer = await _dialogService.DisplayAlertAsync("Confirmer l'enregristrement", "Voulez-vous valider l'enregristrement ?", "Valider", "Annuler");

                if (answer == true)
                {
                    post             = postEdition;
                    post.Name        = Name;
                    post.Description = Description;
                    post.Tags        = SelectedTags;
                    _databaseService.UpdateOrSave(post);
                }
            }
            var navigationParam = new NavigationParameters {
                { "post", post }
            };
            await NavigationService.NavigateAsync("/MenuNavigation/NavigationPage/ListPostPage/PostPage", navigationParam);
        }
Ejemplo n.º 2
0
        public async void UpdateMapCenterAsync()
        {
            var position = await _geolocationService.GetCurrentPosition();

            this.Map.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMiles(1)));
        }