0

这是我的部分代码:

private void btnStart_Click(object sender, EventArgs e)
{
 this.RecognitionWithMicrophone(sender, e);
}

private async Task RecognitionWithMicrophone(object sender, SpeechRecognitionResultEventArgs e)
{
   this.Invoke((MethodInvoker)async delegate
   {...

这是我收到的错误代码:

严重性代码描述项目文件行抑制状态错误 CS1503 参数 2:无法从 'System.EventArgs' 转换为 'WebAppTeleBot.Form1.SpeechRecognitionResultEventArgs' WebAppTeleBot C:\Users\Piglet\Desktop\2018 FYP\TEST FOR TELEBOT\ClientTelebot(test) \WebAppTeleBot\WebAppTeleBot\Form1.cs 347 活动

我收到的错误行在第 3 行:参数e。如何将参数转换eMicrosoft.CognitiveServices.Speech.SpeechRecognition?

4

1 回答 1

0

我相信您永远无法进行这种转换,我认为您甚至不必这样做。按钮单击的 EventArgs 与语音识别无关。

你为什么不只传递空值?

this.RecognitionWithMicrophone(null, null);

或者使用必要的参数创建 SpeechRecognitionResultEventArgs。

于 2018-05-31T04:53:08.987 回答