Well basically you need to store just few pieces of information
- The time the person started to answer questions
- The fixed amount of time that's given to answer the question
To get the current time, you can use
DateTime.Now[
^] property. Using this property you can record the time when answering started and you can also use it when you calculate how much time has been elapsed. To get the remaining time you just subtract the elapsed time from the allowed time.
In order to update your UI to show the remaining time you can use timer as already said or an instance of a
BackgroundWorker[
^] class.
Just remember that you cannot update your UI from another thread so you need to check that the calling thread is the same as the UI thread. In order to do this, you can use the
CheckAccess[
^] method of the Dispatcher.