我在我的应用程序中有一个语音类,并希望能够看到它是否正在侦听,录制,听写或无响应;布尔类型值
我想什么是可以做的是分配一些类型的变量(SpeechState)只是3个可能值1,和对证过,像这样:
startListeningButton_Click(object sender, EventArgs e)
{
SpeechState = SpeechState.Listening;
}
stopListeningButton_Click(object sender, EventArgs e)
{
if(SpeechState.Listening)
{
// Code to STOP listening goes here.
}
}
我曾尝试推行troolean,但这并不完全是我之后的事情。我以后东西与此类似:
if(checkBox1.CheckState == CheckState.Checked)
{
// Do something
}
我怎样才能做到这一点?
使一个'SpeechState' [枚举](http://msdn.microsoft.com/en-us/library/sbbt4032(V = vs.110)的.aspx) ? –
使用emumeration。 –
Troolean:一种俚语,用于描述Microsoft Win32 API中许多地方使用的真/假/错误方案。它被用来描述什么时候某事有3个状态,相比之下,布尔有两个状态(通常是true或false)。 – RvdK