Exemplo n.º 1
0
        async void OnTapGestureRecognizerTapped(object sender, EventArgs args)
        {
            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", ":( No camera avaialble.", "OK");

                return;
            }

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,
                Directory = "Sample",
                Name      = $"BlindSocial{ DateTime.Now.Ticks }.jpg"
            });

            if (file == null)
            {
                return;
            }

            var languages = await CrossTextToSpeech.Current.GetInstalledLanguages();

            var selectedLanguage = languages.Where(x => x.Language.Contains("es")).FirstOrDefault();

            await CrossTextToSpeech.Current.Speak("Se esta procesando la imagen, aguarde por favor", selectedLanguage);

            var blobStorage = DependencyService.Get <IBlobStorage>();
            var url         = await blobStorage.PerformBlobOperation(file.GetStream());

            var text = $"En la imagen puedo reconocer lo siguiente: \n { await apiService.Analize(url) }";

            await Navigation.PushModalAsync(new SpeakPage(text));
        }