|
timers
Jul 28, 2008 15:28:04 GMT
Post by bulldogg on Jul 28, 2008 15:28:04 GMT
could you tell me about more about the GeneralNonsense.Timers namespace
|
|
|
timers
Jul 28, 2008 17:45:40 GMT
Post by Eagle on Jul 28, 2008 17:45:40 GMT
The timer namespace allows you to easilly create a reliable timer through the singleton Factory class, details about this namespace are well documented so please refer to online docs. If you intent to use this in a plug in, make sure you use the protected field in the listener class to access te class Factory. See reference for details. By downloading the source code of the libraries, you can find examples of how to use the factory class in the accompanying unit test library. Note that FLAC itself is using the same factory for its own timers and you should therefor be carefull not to call the StopAllTimers method as that will effectively stop FLAC as well. In order to stop timers you've created, retain a reference to each and call their instance Stop method instead. We can meet on msn for a walkthrough if you wish
|
|
|
timers
Oct 17, 2008 15:50:09 GMT
Post by bulldogg on Oct 17, 2008 15:50:09 GMT
can i get some examplke code of a timer please, im having trouble creating one even with the source libs
|
|
|
timers
Oct 17, 2008 17:05:47 GMT
Post by Eagle on Oct 17, 2008 17:05:47 GMT
public class NotificationHandler: Listener { public NotificationHandler() { _timerFactory.CreateTimer(60, DoWork); }
private void DoWork() { // This method is called once every 60 seconds } }
|
|
|
timers
Oct 17, 2008 17:38:40 GMT
Post by bulldogg on Oct 17, 2008 17:38:40 GMT
oooooooo that makes sense thanks eagle *starts banging away at the keyboard*
|
|
|
timers
Oct 17, 2008 18:44:26 GMT
Post by bulldogg on Oct 17, 2008 18:44:26 GMT
and how do i stop lol, i managed to stop all which broke everything lol so im not gonna use those words again hehe
|
|
|
timers
Oct 18, 2008 6:42:24 GMT
Post by Eagle on Oct 18, 2008 6:42:24 GMT
The Factory method CreateTimer returns a timer instance with which you can stop as well Here's a few lines as example: using EagleWare.Libraries.GeneralNonsense.Timers; ... Timer timer = _timerFactory.CreateTimer(60, DoWork); ... timer.Stop();
|
|
|
timers
Oct 19, 2008 15:28:50 GMT
Post by bulldogg on Oct 19, 2008 15:28:50 GMT
how does stopping another timer within a seperate class for the code of another timer work?
|
|
|
timers
Oct 20, 2008 8:13:56 GMT
Post by Eagle on Oct 20, 2008 8:13:56 GMT
Well you'd have 2 timer instances, say timerA and timerB, and you'd have workers for both, say workerA and workerB. To stop timerA from workerB you'd simply add: timerA.Stop(); to its body. Youd have to use fields to store the timers. I recommend that you follow the code standards used by the EagleWare Libraries to do so and make them private (fields should never be public!) which should be camel cased on top of that all fields should be prefixed with an underscore, so the resulting timer names would be _timerA and _timerB. You should also use more descriptive names instead of A and B as well as avoid abbreviations
|
|