Esempio n. 1
0
        private async Task <bool> TakePhotoAsync()
        {
            if (await cameraService.MustShowRationaleAsync())
            {
                await DisplayAlert(
                    Translations.Dialog_RequiredPermissions_Title,
                    Translations.Dialog_RequiredPermissions_Message);
            }

            bool hasPermissions = await cameraService.CheckPermissionsAsync();

            if (!hasPermissions)
            {
                await DisplayAlert(
                    Translations.Dialog_CheckPermissions_Title,
                    Translations.Dialog_CheckPermissions_Message);

                return(false);
            }

            if (!cameraService.IsCameraAvailable || !cameraService.IsTakePhotoSupported)
            {
                await DisplayAlert(
                    Translations.Dialog_CameraNotAvailable_Title,
                    Translations.Dialog_CameraNotAvailable_Message);

                return(false);
            }

            CurrentMediaFile = await cameraService.GetMediaFileAsync();

            return(true);
        }