/// <summary> /// Raises the distance sended event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnDistanceSensed(object sender, DistanceSensedEventArgs e) { if (this.DistanceSensed != null) { this.DistanceSensed(sender, e); } }
private void _eyes_DistanceSensed(object sender, DistanceSensedEventArgs e) { Debug.WriteLine("{0}ms (distance: {1})", e.Duration.TotalMilliseconds, e.Distance); var blinkPeriod = Math.Min(400, e.Duration.TotalMilliseconds * 150); _animation.Period = TimeSpan.FromMilliseconds(blinkPeriod); }