如何在C#上进行确认对话框?

时间:2019-05-15 01:20:16

标签: c# voice assistant

我希望它关闭计算机,但是当我说“请关闭计算机”时,它将询问我是否确定。如果没有,请返回。

这是我自己为我的个人语音助手准备的。我是C#的新手,所以这样的问题很常见。

if(frase.Equals("turn my computer off please"))
            {
                var input = resposta.SpeakAsync("Are you sure?");
                if(input = "yes")
                {
                    resposta.SpeakAsync("Alright, see you boss! Have a great day.");
                    resposta.SpeakAsync("Suceed!");
                }
                else if(input = "no")
                {
                    resposta.SpeakAsync("Okay!");
                }
            }

此部分出现错误:

if(input = "yes")
(...)
if(input = "no")

它说:

class System.String

Represents the text as a sequence of UTF-16 code units. To search the .NET Framework source code for this type, see the Reference Source.
It is not possible to implicitly convert string type to "System.Speech.Synthesis.Prompt"

0 个答案:

没有答案