System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.ComponentModel.Component System.ComponentModel.ISupportInitialize System.ComponentModel.DefaultProperty("Interval") System.ComponentModel.DefaultEvent("Elapsed") Provides a mechanism to trigger events at a preset interval.

The Timer component raises the event at recurring intervals, set by the property.

By default this timer executes the Elapsed event handlers on a thread from the , however this behaviour can be changed by providing an instance of to the property.

By default, the property is true and the timer will raise the event multiple times. To cause the Timer to raise this event once only, set to false.

As mentioned previously, event handlers are raised on a thread from the . It is possible that the timer Interval will pass before processing of the previous event handler is complete and cause two threads to execute the event handler simultaneously. As such, you should ensure that your event handlers are reentrant.

As the Elapsed event handlers are raised on a ThreadPool thread, a race condition exists where the event handler may be executed after has been called on a separate thread. If it is cruical that the Stop thread not continue until the event handler completes, use a stronger synchronization mechanism such as the class.

`using System; using System.Timers; public class TimerExample { private static System.Timers.Timer ourTimer; public static void Main() { ourTimer = new System.Timers.Timer(); // attach to the Elapsed event. ourTimer.Elapsed += new ElapsedEventHandler(OnTimerElapsed); // make our timer interval 1 second ourTimer.Interval = 1000; // don't forget to enable the timer! // we could also call ourTimer.Start() here; they both have the same effect // (starting the timer). ourTimer.Enabled = true; Console.WriteLine("Waiting 10 seconds before exit..."); System.Threading.Thread.Sleep(10000); } private static void OnTimerElapsed(object sender, ElapsedEventArgs e) { Console.WriteLine("Timer elapsed at: " + e.SignalTime.ToLongTimeString()); } }`
- Constructor
  Constructs and initializes a new instance of the class with properties set to default values.

  Below are the default values applied when using this constructor:

  Property
  Initial Value
  AutoReset
  true
  Interval
  100
  Enabled
  false
  1.0.5000.0
  2.0.0.0
- Constructor
  The Interval duration, in milliseconds.
  Constructs and initializes a new instance of the class with the specified .

  Constructs a new instance with the specified interval. All other properties retain their default values.

  For a list of default values, see

  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean Get or set a value which determines whether the event is raised multiple times (once for each time passes), or just once. true if the timer will raise the Elapsed event multiple times when Interval passes, false if it will raise it just once. A value which determines whether the event is raised multiple times (once for each time passes), or just once. 1.0.5000.0 2.0.0.0 System.Timers.TimersDescription("Indicates whether the timer will be restarted when it is enabled.") System.ComponentModel.DefaultValue(true) System.ComponentModel.Category("Behavior")
- Method
  System.Void This method currently does nothing. This method exists to satisfy interface requirements but has no purpose. 1.0.5000.0 2.0.0.0
- Method
  System.Void Disables the timer. This has the same effect as calling , or setting to false. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` true if the object is being disposed, false otherwise. Disables and disposes of the timer component. Disables and disposes of the timer component. 1.0.5000.0 2.0.0.0
- Event
  System.Timers.ElapsedEventHandler This event is raised when the specified elapses.

  If is true, this event will be raised only once. Otherwise, this event will be raised once for each time elapses.

  To see an example of how to use this event, see the class documentation.

  1.0.5000.0
  2.0.0.0
  System.Timers.TimersDescription("Occurs when the Interval has elapsed.")
  System.ComponentModel.Category("Behavior")
- Property
  System.Boolean Get or set a value indicating whether this timer is enabled or disabled. Boolean true if this timer is enabled, or boolean false if this timer is disabled.

  Using this property is equivalent to calling or .

  Disabling a timer that has been enabled, but whose has not elapsed will cause that timer not to raise its event.

  1.0.5000.0
  2.0.0.0
  System.Timers.TimersDescription("Indicates whether the timer is enabled to fire events at a defined interval.")
  System.ComponentModel.DefaultValue(false)
  System.ComponentModel.Category("Behavior")
- Method
  System.Void This method currently does nothing. This method exists to satisfy interface requirements but has no purpose. 1.0.5000.0 2.0.0.0
- Property
  System.Double To be added Double value representing the number of milliseconds for the interval.

  Changing this property after starting the timer will have no effect. For example, if I set Interval to 5 seconds, enable the timer and once 3 seconds pass I set Interval to 10 seconds, the event will still be raised after the original 5 seconds, not 13 seconds as could be assumed.

  1.0.5000.0
  2.0.0.0
  System.Timers.TimersDescription("The number of milliseconds between timer events.")
  System.ComponentModel.RecommendedAsConfigurable(true)
  System.ComponentModel.DefaultValue(100)
  System.ComponentModel.Category("Behavior")
- Property
  System.ComponentModel.ISite To be added To be added: an object of type 'ComponentModel.ISite' To be added 1.0.5000.0 2.0.0.0
- Method
  System.Void Causes the timer to begin raising events.

  Calling this method has the same effect as setting to true.

  For an example covering the use of the Timer class, see the class documentation.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void Causes the timer to stop raising events.

  Calling this property has the same effect as setting to false.

  A race condition exists where an event handler may be executed after a call to Stop has been made. See the main class documentation for more information.

  1.0.5000.0
  2.0.0.0
- Property
  System.ComponentModel.ISynchronizeInvoke To be added To be added: an object of type 'ComponentModel.ISynchronizeInvoke' To be added 1.0.5000.0 2.0.0.0 System.ComponentModel.Browsable(false) System.Timers.TimersDescription("The object used to marshal the event handler calls issued when an interval has elapsed.") System.ComponentModel.DefaultValue(null)