简体   繁体   English

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

[英]Turn off default sound when displaying MessageBox in WP7

有没有一种方法可以关闭Messagebox在WP7中显示时播放的声音?

There's no way to change this behaviour with the Silverlight MessageBox class. 使用Silverlight MessageBox类无法更改此行为。 If, however, you use Guide.BeginShowMessageBox (from the XNA libraries) you can control whether sounds are played or not. 但是,如果使用Guide.BeginShowMessageBox (来自XNA库),则可以控制是否播放声音。

No, currently there is no way you can disable the sound that is triggered by the MessageBox class. 否,当前无法禁用MessageBox类触发的声音。 That is a feature tied to the system and unless the device is on mute, the sound will be played. 这是与系统相关的功能,除非设备处于静音状态,否则将播放声音。

With XNA's async version you can do this, though (as mentioned by Matt): 但是,使用XNA的异步版本,您可以执行此操作(如Matt所述):

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

Here, MessageBoxIcon defines the sound and not the icon (which is nonexistent on Windows Phone for a MessageBox ). 在这里, MessageBoxIcon定义声音而不是图标( MessageBox Windows Phone上不存在)。

Note: you need yo add a reference to Microsoft.Xna.Framework.GamerServices . 注意:您需要添加对Microsoft.Xna.Framework.GamerServices的引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM