Help with Timer

I am developing a parenting educational course with specific requirenments regarding how much time the student needs to spend on each particular lesson. I am looking for a timer code that:
1. Track and display how much time they have spend on the current lesson.
2. Makes a button (or a link to a new form) available after 40 minutes has passed on the current lesson to jump to the next section
3. The hardest one ( I think) Stores time they have already completed, so next time they run the application again the student will be credited for time spend.
Any help will be greatly appreciated.
Thanks


Answer this question

Help with Timer

  • venky_m

    The way I would handle this is to create a property/variable on the current lesson which hold the start time and duration for next lesson button to appear.

    The in the current lesson you have a timer event which occurs every 1 minute.

    This timer tick event compares the current time with the (Starttime + Duration) - if the current time is greater then you can make the next lesson button visible.

    To track the time on the current lesson - Current Time (Now) - Lesson Start Time (held in the current lesson property)

    So you can calculate the total time on lesson at any point but may update the time on lesson in the same tick event.

    The storing time spent on lesson is probably a further refinement of saving time spend on lesson to a database - and retrieving it at the start of the lesson - so total time on lesson would be TotalTimeFromTheDatabase + ( Now - Current Lesson Start Time)

    So basically each time you leave a lesson you save the total time to the database and each time you go back to a lesson you would get this value from the database. Set the current lesson start time to now. And its simply adding the current session Lesson Time to the database time. When they leave the lesson you would simply update the database total.


  • jrcran

    Hello Jorge,

    1. You can use Timer control for doing this. You can learn more about timer control at this site http://msdn.microsoft.com/vstudio/express/vb/learning/ and scroll down to the Lesson 10.

    If you have any implementation questions please convey.

    2. You can write a code to enable a button in the Timer Controls Tricks or Elapsed Event. Depending on which Timer Control you are using.

    3. You need a database for storing this data. you can retrieve data retaliated to the student when the student Login to your application. When the lesson is finished or student log out from the application you need to store that data back.

    I hope this will help.

    Regards,

    Vallari


  • Help with Timer