Tag Archives: Vibrate

Vibration Behaviors for Windows Phone – Part 1

So I got my wife an HTC Titan for Christmas and I loved the way it vibrates compared to my Focus. It just feels nice with much lower frequency, while the vibrations on the Focus are a bit like an electric shock. This got me thinking that it would be nice to have the same sort of haptic feedback you get on the 3 hardware buttons on the regular Silverlight buttons. While you could just handle the touch events on every button you choose – it is a lot of code that just gets duplicated all over your app and it is hard to update it globally – e.g. if you want to allow the user to switch it off everywhere or automatically preconfigure it when the app first runs based on the device used. The best solution for it seems to be to create a Behavior that you can easily attach to any button, so that is what I had set off to create.

Continue reading

Tagged , , , ,

Good Vibrations on Windows Phone

I thought I’d do something foolish today and decided to play with a Windows Phone API I never used before – the VibrateController. How about playing back a rhythm? I coded up a very simple API to play back sequences of vibrations. You just build a VibrationSequence object with a list of Vibrations that specify vibration duration and a delay between the vibration start and the next vibration.

This is the code that plays it back:

var seq = new VibrationSequence(
    new Vibration(250, 500), 
    new Vibration(250, 1250), 
    new Vibration(200, 250), 
    new Vibration(250, 500), 
    new Vibration(250, 1500));

And here is the VibrationSequence API:

Continue reading

Tagged , , ,