Some small things, which are not needed in application, can add little charm to it. One of such a thing are vibrations. Vibration can be used in different ways. Vibrations can be used for example as:

  • acceptance of user’s actions by the program’s activities,
  • notification , that something has changed on the phone,
  • sounds replacement,
  • etc.

This little things can cause, that the application will evaluate better. And as it turns out, adding this functionality is very easy.

Just one line of code:

using Microsoft.Devices;
...
VibrateController.Default.Start(TimeSpan.FromMilliseconds(500))

Hmm, maybe two counting – using.

The code above will make, that the phone will vibrate through 500 milliseconds. Maximum duration of vibration may reach 5 second. Exceeding this range will cause an exception.