469,643 Members | 2,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Timer as form inactivity monitor - tick event firing unexpectedly

Dan
Hi,

I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on
the form. Users have reported the form closing in the middle of them typing
or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if
rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).

Regards,

Dan
Nov 20 '05 #1
4 3085
On your keydown / mouseevents are you calling your timer to stop? reset the
interval, and start again? (reseting the interval isn't important really..)
"Dan" <no**********@sorrynospamwanted.com> wrote in message
news:5F*******************@twister.nyroc.rr.com...
Hi,

I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on the form. Users have reported the form closing in the middle of them typing or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).

Regards,

Dan

Nov 20 '05 #2
Cor
Hi Dan,

When I was you I just would check my reset procedure setting the times
something more narrow.

But I would never use a thread timer, that one I could until now not reset.
(It goes direct in his own thread when it start and fires even if the
program is ended).

For this I find the forms timer the nicest.

Just my thought,

Cor
Nov 20 '05 #3
* "Dan" <no**********@sorrynospamwanted.com> scripsit:
I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that
is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have
elapsed without any user activity I want the form to close. I stop/start
the timer at button clicks and keydown events etc of the various controls on
the form. Users have reported the form closing in the middle of them typing
or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this
occur once during testing where an event fired that should have reset the
timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have
elapsed instead of 60 then don't do anything). This of course won't help if
rather than a timer failure, its the keydown and other events that are not
firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).


Post the code you use to reset the timer.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>
Nov 20 '05 #4
Dan

Private Sub ResetTimer()
timer1.stop()
timer1.start()
End Sub

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Dan" <no**********@sorrynospamwanted.com> scripsit:
I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have elapsed without any user activity I want the form to close. I stop/start the timer at button clicks and keydown events etc of the various controls on the form. Users have reported the form closing in the middle of them typing or immediately after opening the form (but only rarely). (The timer is
design-time set to Enabled = false, Interval = 60000) I think I saw this occur once during testing where an event fired that should have reset the timer and about 15 seconds later the tick event fired. As a workaround
possibly I am going to store the time of the last reset so that I can
compare to the time when the tick event fires (ie if only 15 seconds have elapsed instead of 60 then don't do anything). This of course won't help if rather than a timer failure, its the keydown and other events that are not firing. Any similiar experiences or other suggestions for monitoring
inactivity (such as using the thread timer).


Post the code you use to reset the timer.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Lloyd Sheen | last post: by
8 posts views Thread by Daniel P. | last post: by
5 posts views Thread by Jason | last post: by
9 posts views Thread by Brett | last post: by
8 posts views Thread by RobcPettit | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.