I want to measure time (seconds) when a user presses the right arrow key on the keyboard and pick it up.
I have researched about this and find some page but there is not a good answer.
How can I measure this time?
my code
I define a List in top of class:
List<int> date_down = new List<int>();
when user press right arrow key : (in Form_KeyDown method)
if (Keyboard.IsKeyDown(Key.Right))
{
date_down.Add(DateTime.Now.Second);
}
when user press right arrow key and held down times Add into list
when user pick up key (in Form_keyUp method)
if (e.Key == Key.Right)
{
var second = DateTime.Now.Second - date_down[0];
}