The VibrateController Class

 

I am currently working on another Windows Phone Application, where I needed a way to show the user that they had successfully performed a task and therefore unlocked another feature inside the application.

First idea was adding some sound, but somehow I was not happy with that. So I thought, why not let the phone vibrate?

It’s actually not that hard. The Windows Phone 7 SDK allows me to control the vibrate function easily.

In the namespace Microsoft.Devices there is a class defined with the name ‘VibrateController’.

The only code I need for that function is:

Code Snippet
  1. private void Button_Click(object sender, RoutedEventArgs e)
  2. {
  3.     VibrateController vibrate = VibrateController.Default;
  4.     vibrate.Start(TimeSpan.FromMilliseconds(1000));
  5.  
  6. }

 

When the user clicks the particular button, the phone vibrates.

A few thoughts to keep in mind:

1. the shortest vibration / pause is 0.1 seconds.

2. the longest is 5 seconds, but that is not recommended.

3. 3 vibrations in one sequence are enough.

4. 0.2 / 0.3 are good choices for an alert.

 

Here you can find more information about the VibrateController Class.

 

To be continued…

One Response to “The VibrateController Class”

  1. Hi, I come and registered.
    I’ll learn and make my first software here.
    I’ll become your honest reader!
    Thanks for your helps!