You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何编写判断AudioGraph(graph2)已停止的If语句?

问题解决:AudioGraph状态判断的正确写法

错误原因:直接使用Stopped属于未定义标识符,它是AudioGraphState枚举的成员,必须通过枚举类型前缀引用才能被编译器识别。

正确的If语句实现代码:

if (graph2.State == AudioGraphState.Stopped)
{
    playButton.Content = "Play Recorded File";
}

补充说明:

  • AudioGraph实例的运行状态需通过其State属性获取,该属性的类型为AudioGraphState枚举
  • AudioGraphState枚举包含Stopped、Running、Paused等状态选项,必须以「枚举类型+成员名」的完整形式引用

内容的提问来源于stack exchange,提问作者Giovanni Briones

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 08:12:02