Microsoft.Devices.VibrateController.Start C# (CSharp) Méthode

Start() public méthode

public Start ( System.TimeSpan duration ) : void
duration System.TimeSpan
Résultat void
        public void Start(TimeSpan duration)
        {
            if (duration.TotalSeconds > 5.0 || duration.TotalSeconds < 0.0)
                throw new ArgumentOutOfRangeException("duration", duration, "duration must be between 0 and 5 seconds");

            var vibrator = (Vibrator)Application.Context.GetSystemService(Context.VibratorService);
            vibrator.Vibrate((long)duration.TotalMilliseconds);
        }

Usage Example

 private void TiempoVibracion(double tiempo)
 {
     objVibrador = VibrateController.Default;
     objVibrador.Start(TimeSpan.FromSeconds(tiempo));
 }
All Usage Examples Of Microsoft.Devices.VibrateController::Start
VibrateController