private async void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) { if (!this.Completed) { try { //sender.StopAsync(); //this.Completed = true; sender.CancelAsync(); } catch (Exception) { } await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var mensaje = args.Result.Text.Replace(".", string.Empty); if (mensaje.Contains("Text")) { mensaje = "Texto"; } var vm = new ImageSearchViewModel(); // mensaje = "Texto"; vm.Search(mensaje); if (vm.SearchResult.Count > 0) { Frame.Navigate(typeof(SearchListView), vm); } else { var auth = new Authentication("713034f5c7994f089c1d5a70c1a12ede", "54c4cd393679455d90a48250cde0cfa4"); var token = auth.GetAccessToken(); var requestUri = "https://speech.platform.bing.com/synthesize"; var sb = new StringBuilder(); sb.AppendFormat("No se han encontrado resultados de búsqueda."); var cortana = new Synthesize(new Synthesize.InputOptions() { RequestUri = new Uri(requestUri), Text = sb.ToString(), VoiceType = Gender.Female, Locale = "es-es", VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)", OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm, AuthorizationToken = "Bearer " + token.access_token, }); cortana.OnAudioAvailable += PlayAudio; cortana.OnError += ErrorHandler; cortana.Speak(CancellationToken.None); cortana = null; } }); } }