为什么我的程序重复说一行C#

时间:2016-04-01 09:59:09

标签: c# speech-recognition speech

当我说"退出"为了让我的程序停止,它说了几次相同的行,然后退出。我怎么能解决这个问题,所以它只说了一次?

谢谢!

        public void say(String h)
    {
        synth.Speak(h);
    }

    private void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
        string r = e.Result.Text;

        if(r == "how are you")
        {
            say("Good and you?");
        }

        if(r == "start youtube")
        {
            say("Opening youtube");
            Process.Start("https://www.youtube.com/");
        }

        if(r == "quit" || r == "exit")
        {
            say("exiting Home A i");
            Application.Exit();
        }
    }

0 个答案:

没有答案