没有重载匹配委托system.speech.recognition.speechRecognizedEventargs

时间:2015-10-21 20:10:01

标签: c# sapi

我正在研究sapi。我制作了一个简单的控制台应用程序并尝试测试sapi。

class Program
    {
        public  void abc(SpeechRecognizedEventArgs e)
        {
            switch (e.Result.Text)
            {
                case "say hello":
                    Console.WriteLine("Hi");
                    break;
                case "my name is irfan":
                    Console.WriteLine("hello irfan!");
                    break;
            }
        }
        public static void Main(string[] args)
        {
            SpeechRecognitionEngine sREngine = new SpeechRecognitionEngine();

            Choices com = new Choices();
            com.Add(new string[] { "say hello", "my name is irfan" });
            GrammarBuilder gb = new GrammarBuilder();
            gb.Append(com);
            Grammar gram = new Grammar(gb);
            sREngine.LoadGrammarAsync(gram);
            sREngine.SetInputToDefaultAudioDevice();
            sREngine.RecognizeAsync(RecognizeMode.Multiple);
            sREngine.SpeechRecognized += abc; //getting error over there.

        }
    }

我在调用函数abc时遇到错误。错误是:

“没有超载匹配委托system.speech.recognition.speechRecognizedEventargs”

我做错了什么?

1 个答案:

答案 0 :(得分:1)

您的处理程序签名错误。它应该是:

std::for_each