void AskQuestionMethod(string question)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                _error = new UIAlertView(question, "Please, answer after the signal", null, "NO", "Yes");
                _error.Clicked += (sender, buttonArgs) =>
                {
                    StopListening();
                    _recognitionTask.TrySetResult(buttonArgs.ButtonIndex != _error.CancelButtonIndex);
                };
                _error.Show();
            });

            TextToSpeechService.Speak(question, false).Wait();

            TextToSpeechService.Speak("Please, answer after the signal", false).Wait();

            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.Playback);
                AVAudioSession.SharedInstance().SetActive(true);
                //SystemSound notificationSound = SystemSound.FromFile(@"/System/Library/Audio/UISounds/jbl_begin.caf");
                //notificationSound.AddSystemSoundCompletion(SystemSound.Vibrate.PlaySystemSound);
                //notificationSound.PlaySystemSound();

                _audioPlayer = AVAudioPlayer.FromUrl(NSUrl.FromFilename(Path.Combine("Sounds", "tap.aif")));
                _audioPlayer.PrepareToPlay();
                _audioPlayer.Play();
            });
             
            Question = question;
            StartListening();
        }
        async Task AskQuestionMethod(string question)
        {
            if (_speechRecognizer != null)
            {
                //StopRecognizer();
                CancelDialog();
            }

            _isMusicRunning = PlatformService.IsMusicRunning;

            if (_isMusicRunning)
            {
                PlatformService.PauseMusic();
            }

            _handler = new Handler(Application.Context.MainLooper);

            if (await TextToSpeechService.Speak(question, false))
            {
                if (await TextToSpeechService.Speak("Please, answer yes or no after the tone", false))
                {
                    if (isTimeStarted)
                    {
                        Question = question;
                        StartSpeechRecognition();
                    }
                }
            }
        }
Beispiel #3
0
        public MainViewModel(IMscsService mscsService, ISerializationService serializationService,
                             IPhotoService photoService, IMessageBoxService messageBoxService,
                             ITextToSpeechService textToSpeechService, ILocationService locationService,
                             IGeocodingService geocodingService, ISpeechToTextService speechToTextService,
                             IPublicTransportServices publicTransportServices,
                             ITranslationService translationService,
                             IMvxAndroidCurrentTopActivity activity)
        {
            this._mscsService             = mscsService;
            this._photoService            = photoService;
            this._messageBoxService       = messageBoxService;
            this._textToSpeechService     = textToSpeechService;
            this._locationService         = locationService;
            this._geocodingService        = geocodingService;
            this._speechToTextService     = speechToTextService;
            this._publicTransportServices = publicTransportServices;
            this._translationService      = translationService;

            this._checkNetwork  = new CheckInternetConnection();
            this._checkLocation = new CheckLocationAvailability();

            this._speechToTextService.MessageChanged += HandleMessageChanged;
            this._photoService.PhotoChanged          += HandlePhotoChanged;

            _textToSpeechService.Speak(
                "Witaj w aplikacji blind. Tapnij na ekran i powiedz komende dla danej funkcji. Aby uzyskaæ informacjê o dostêpnych funkcjach tapnij w ekran i powiedz menu");

            CheckSettingsAfterStart();
        }
        private void buttonSpeak_Clicked(object sender, EventArgs ea)
        {
            string text_to_speak = editorTextToSpeak.Text;

            text_to_speech_service.Speak(text_to_speak);

            return;
        }
 public async virtual Task Notify(string message)
 {
     if (!_platform.IsAppInForeground)
     {
         _notificationSender.SendLocalNotification("Toll Minder", message);
     }
     _textToSpeech.Speak(message).Wait();
 }
 public TextToSpeechViewModel(ITextToSpeechService speech, IUserDialogService dialogs) {
     this.Speak = new Command(() => {
         if (String.IsNullOrEmpty(this.Text)) 
             dialogs.Alert("Please enter the text!");
         else 
             speech.Speak(this.Text);
     });
     this.Cancel = new Command(speech.Stop);
 }
 public TextToSpeechViewModel(ITextToSpeechService speech, IUserDialogService dialogs)
 {
     this.Speak = new Command(() => {
         if (String.IsNullOrEmpty(this.Text))
         {
             dialogs.Alert("Please enter the text!");
         }
         else
         {
             speech.Speak(this.Text);
         }
     });
     this.Cancel = new Command(speech.Stop);
 }
Beispiel #8
0
        private async void Geocoding()
        {
            try
            {
                if (!CheckSettings(SettingsToCheck.Localization))
                {
                    await _textToSpeechService.Speak("Do poprawnego dzia³ania aplikacji potrzebna jest aktywna lokalizacja");

                    return;
                }

                await InProgress();

                var location = await _locationService.GetPosition();

                var result = await _geocodingService.Geocoding(location["Latitude"], location["Longitude"]);

                var result2 = await _geocodingService.ReverseGeocoding(result);

                result = await _geocodingService.Geocoding(result2["Latitude"], result2["Longitude"]);

                await _textToSpeechService.Speak(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #9
0
 private void Speak()
 {
     _textToSpeechService.Speak(Message);
 }
Beispiel #10
0
 public TtsApp(ITextToSpeechService tts, IHaContext ha)
 {
     tts.Speak("media.MyMediaPlayer", "Welcome");
 }