Пример #1
0
        private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.recoWithUI = new SpeechRecognizerUI();

            // Start recognition (load the dictation grammar by default).
            SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();

            String result = await Outils.RecoInteract(recoResult.RecognitionResult.Text);

            if (!String.IsNullOrEmpty(result))
            {
                JObject res = JsonConvert.DeserializeObject <JObject>(result);
                if (res["result"] != null && !String.IsNullOrEmpty(res["result"].ToString()))
                {
                    SpeechSynthesizer synth = new SpeechSynthesizer();

                    await synth.SpeakTextAsync(res["result"].ToString());
                }
            }
        }