示例#1
0
        public static async Task Dispose(this SpeechRecognitionManager speechRecognitionManager)
        {
            await speechRecognitionManager.SpeechRecognizer.ContinuousRecognitionSession.StopAsync();

            speechRecognitionManager.SpeechRecognizer.Dispose();

            speechRecognitionManager.SpeechRecognizer = null;
        }
        public async void StartRecognizing()
        {
            speechRecognizer = new SpeechRecognitionManager.SpeechRecognitionManager("Grammar.xml");

            speechRecognizer.SpeechRecognizer.ContinuousRecognitionSession.ResultGenerated += continuousRecognitionSessionOnResultGenerated;

            speechRecognizer.SpeechRecognizer.RecognitionQualityDegrading += (sender, args) =>
            {
                Debug.WriteLine("Quality" + args.Problem.ToString());
            };

            speechRecognizer.SpeechRecognizer.ContinuousRecognitionSession.Completed += (sender, args) =>
            {
                Debug.WriteLine("Completed" + args.Status.ToString());
            };

            await speechRecognizer.CompileGrammar();

            Debug.WriteLine("Speech recognition started.");
            Debug.WriteLine(speechRecognizer.SpeechRecognizer.State);
        }