473,657 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3329
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**********@s orrynospamwante d.com> wrote in message
news:5F******** ***********@twi ster.nyroc.rr.c om...
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**********@s orrynospamwante d.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**********@s orrynospamwante d.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2960
by: Lloyd Sheen | last post by:
I have a problem where I cannot read (all the time) a file when caught by the FileSystemWatcher. What I have done to get past this is create an array of events (when I receive one I add it to the list). I then enable a timer which will attempt to process the first one in the list. The timer code is never executed. There is a handles clause on the timer and using the debugger I have watched the code for the FileSystemWatcher execute. ...
13
7476
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on it, a frontend and a backend. Case 1: If vba code on the frontend updates many rows (360,000) on the backend, a form's timer event (from the frontend) will stop firing until the user gives the form focus. (Note that the update itself always...
8
2773
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get called? private System.Windows.Forms.Timer timerDF; this.timerDF = new System.Windows.Forms.Timer(this.components);
5
16033
by: Jason | last post by:
I have an application that uses a timer. I've created a function called TickEvent that I "assigned" to the timer1.Tick event: this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.TickEvent); .... private void TickEvent(object sender, System.EventArgs e) { liSecondsElapsed++; DateTime lsTime = Convert.ToDateTime(liSecondsElapsed);
7
2374
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly reset I put some extra code in the subs that enable and disable the timer. They fire as expected. To test this I added a second timer with a 1 second interval. The event for this time would output the enabled status of the first timer and its...
9
7239
by: Brett | last post by:
I have a timer enabled on a form with an interval of 200. I place a break point on the first line in the timer tick event, which is a try. After a few events go on, the timer seems to stop. My break point is no longer hit. In the debugger, the timer shows enabled and the interval is still set. Any ideas what may be happening or something else I can check? Thanks, Brett
8
3553
by: RobcPettit | last post by:
Hi Im using System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += new ElapsedEventHandler(onTimer); myTimer.Interval = 1000; myTimer.Start(); and getting error onTimer does not exist in the current context. Any Ideas Regards Robert
5
12213
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the event handlers may take longer than the interval for either of the timers, so it's possible for multiple events to fire "simultaneously" and for events to queue up. I'm attempting to get the timers to sync on some reference type object, or use...
16
3248
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not do it. If I bring this same code outside this event handler, it works just fine. Is this normal?
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.