Example #1
0
        private async Task TakePhotoCommandExecute()
        {
            bool permissionResult = await PermissionService.AskPermission();

            if (permissionResult)
            {
                IsLoading = true;
                var photoModel = await _mediaHelper.TakePhotoAsync();

                if (photoModel != null)
                {
                    Photos.Add(photoModel.ToPhotoViewModel());
                    PhotosCollectionChanged?.Invoke(this, EventArgs.Empty);
                }
                IsLoading = false;
            }
        }
Example #2
0
        private async void RequestPermissionButton_OnClicked(object sender, EventArgs e)
        {
            var result = await _permissionService.AskPermission();

            if (result)
            {
                _alertService.ShowOkAlert("Permission GRANTED!", "Ok");
            }
            else
            {
                _alertService.ShowOkAlert("Permission DENIED!", "Ok");
            }
        }
        private async Task TakePhoto()
        {
            bool permissionResult = await _permissionService.AskPermission();

            if (permissionResult)
            {
                IsLoading = true;
                try
                {
                    var model = await _mediaHelper.TakePhotoAsync();

                    if (model != null)
                    {
                        GalleryItemModels.Add(model);
                    }
                }
                catch (Exception ex)
                {
                    await UserDialogs.Instance.AlertAsync(ex.Message);
                }
            }
            IsLoading = false;
        }