当我说"退出"为了让我的程序停止,它说了几次相同的行,然后退出。我怎么能解决这个问题,所以它只说了一次?
谢谢!
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();
}
}