Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Periodic Timers - how to prevent autostart?
PostPosted: Mon Mar 25, 2013 6:43 am 

Joined: Tue Nov 20, 2012 3:06 am
Posts: 22

Offline
I have tried this example:
viewtopic.php?f=9&t=5

But my question is, how could I prevent the timer from starting right after when the application is started? Now it starts counting automatically, and that's why I cannot use it properly.

Thanks in advance!


 Profile  
 
 Post subject: Re: Periodic Timers - how to prevent autostart?
PostPosted: Mon Mar 25, 2013 7:58 am 
User avatar

Joined: Thu Nov 29, 2012 2:27 pm
Posts: 92

Offline
Remove

Code:
timer1.Enabled = true;   

timer2.Enabled = true;     



From the constructor.

So it looks like this

Code:
 static TimerScript()
      {
         timer1 = new Timer();
         timer1.Tick += new EventHandler(TimeOut1);
         timer1.Interval = 1000;
         
         
         timer2 = new Timer();
         timer2.Tick += new EventHandler(TimeOut2);
         timer2.Interval = 250;
         
      }

_________________
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group


 Profile  
 
 Post subject: Re: Periodic Timers - how to prevent autostart?
PostPosted: Tue Mar 26, 2013 5:06 am 

Joined: Tue Nov 20, 2012 3:06 am
Posts: 22

Offline
That's it - thanks a lot, Edmund!! :)


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: