【问题标题】:SpeechSynthesizer error in 'await' in windows phone 8Windows Phone 8 中的“等待”中的 SpeechSynthesizer 错误
【发布时间】:2014-03-01 10:08:41
【问题描述】:

我在 SpeechSynthesizer 中收到一个错误,它显示:

错误:“等待”要求类型“Windows.Foundation.IAsynAction” 有一个合适的 GetAwaiter 方法。你是否缺少指令 “系统”?

我使用纯文本,我的代码是这样的

await synth.SpeakTextAsync(titleTextBox.Text);

【问题讨论】:

    标签: c# windows-phone-7 windows-phone-8 windows-phone speechsynthesizer


    【解决方案1】:

    在方法头添加async关键字。

        private async void MethodName()
        {
            var synth = new SpeechSynthesizer();
            await synth.SpeakTextAsync(titleTextBox.Text);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多