Big*_*ete 13 c# silverlight windows-phone-7
我在哪里可以找到有关如何为Windows Phone 7实现触觉反馈的文档?我希望手机在按下按钮时发出短暂的震动.
Fra*_*ori 18
基本上你需要让手机振动的是:
VibrateController.Default.Start(TimeSpan.FromMilliseconds(200));
Run Code Online (Sandbox Code Playgroud)
我建议阅读这篇博客,因为它解释得很好.如果您还没有看到它们,其他章节也很有趣.
我为我的按钮创建了一个振动类,以便于调用.这是我的代码.如果你愿意,请给我+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();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2249 次 |
| 最近记录: |