Is there an easy way to detect shake motions on Windows Phone 8?

ⅰ亾dé卋堺 提交于 2019-11-28 04:34:12

问题


I need to detect a shake movement on a Windows Phone 8 device, in order to launch a specific action. How can I do that ?

I found several mentions of a "ShakeGesture.dll" library made by Microsoft for WinPhone7, but the only place where it was available (AppHub) was replaced by the Dev Center website...

Thanks for your help!


回答1:


That's odd. Looks like the AppHub to DevCenter rename broke the download links.

I've uploaded the library to my domain in the meanwhile until those links get fixed @ http://JustinAngel.net/Storage/ShakeGestures.zip




回答2:


Here's an example on how to use the Shake Gesture Library:

http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/01/shake-gestures-library-a-windows-phone-recipe.aspx

You should be able to add a reference to the ShakeGestures.dll assembly to get started. If you're using the Windows Phone 8 SDK, I believe this library is included - you'll just need to add the reference.

UPDATE:

You should be able to download it with this link: http://go.microsoft.com/fwlink/?LinkId=219094

I found that here. If you scroll down to "Locations and Sensors" about 2/3 of the way down, there's a link to download the gesture library as well as an example.

UPDATE 2:

Hmm. It appears that download link was the sample project. The ShakeGestures.dll doesn't seem to be in it either. I don't have VS2012 on my computer here at work, but if you do, you could open up the sample solution and see if it is referencing that DLL somehow, and maybe see where it points? It seems like it has to be using it...I just can't open it in VS2010.




回答3:


  1. Download ShakeGestureLibraryCS from Windows Phone Developer Samples: http://code.msdn.microsoft.com/wpapps/Shake-Gesture-Library-04c82d5f

  2. Download C# project and Build (for Release) to create the 'ShakeGestures.dll'

  3. Add Reference to your WindowsPhone project.



来源:https://stackoverflow.com/questions/14505482/is-there-an-easy-way-to-detect-shake-motions-on-windows-phone-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!