在WP7中显示MessageBox时关闭默认声音

时间:2011-05-07 00:44:03

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

有没有办法关闭Messagebox在WP7中播放时播放的声音?

2 个答案:

答案 0 :(得分:4)

无法使用Silverlight MessageBox类更改此行为。但是,如果使用Guide.BeginShowMessageBox(来自XNA库),则可以控制是否播放声音。

答案 1 :(得分:1)

不,目前无法禁用MessageBox类触发的声音。这是与系统相关的功能,除非设备处于静音状态,否则将播放声音。

使用XNA的异步版本,你可以这样做(如Matt所说):

Guide.BeginShowMessageBox("Title", "Text", new List<string>() { "OK" }, 0, MessageBoxIcon.None, new AsyncCallback(YourCallback), null);

此处,MessageBoxIcon定义了声音,而不是图标(Windows Phone上不存在MessageBox)。

注意:您需要添加对Microsoft.Xna.Framework.GamerServices的引用。

相关问题