我在哪里可以找到有关如何为Windows Phone 7实施触觉反馈的文档?我希望手机在按下按钮时发出短暂的震动。
答案 0 :(得分:18)
基本上你需要让手机振动的是:
VibrateController.Default.Start(TimeSpan.FromMilliseconds(200));
我建议阅读this blog因为它解释得很好。 other chapters如果您还没有看过它们,也很有趣。
答案 1 :(得分:5)
我为我的按钮创建了一个振动类,以便于调用。这是我的代码。如果你愿意,请给我+1。
public class Vibration
{
public static void VibrateOnButtonPress()
{
Microsoft.Devices.VibrateController.Default.Start(TimeSpan.FromMilliseconds(50));
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0, 0, 200);
timer.Tick += (tsender, tevt) =>
{
var t = tsender as System.Windows.Threading.DispatcherTimer;
t.Stop();
Microsoft.Devices.VibrateController.Default.Stop();
};
timer.Start();
}
}
答案 2 :(得分:2)
也许您可以使用XNA API来设置“GamePad”的振动 http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.input.gamepad.setvibration.aspx
我很想知道你是否能在银光下工作,请在试用后发表评论: - )