Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in Windows Forms applications and must be used in a window.
Public Events | |
event< timer, event_handler > | tick |
Occurs when the specified timer interval has elapsed and the timer is enabled. | |
Public Constructors | |
timer () | |
Initializes a new instance of the timer class. | |
Public Properties | |
virtual bool | enabled () const noexcept |
Gets whether the timer is running. | |
virtual timer & | enabled (bool enabled) |
Sets whether the timer is running. | |
virtual time_span | interval () const noexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
timer & | interval (const time_span &interval) |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
virtual int32 | interval_milliseconds () const noexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
virtual timer & | interval_milliseconds (int32 interval) |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
Public Methods | |
void | start () |
Stops the timer. | |
void | stop () |
Starts the timer. | |
Public Static Methods | |
static timer | create () |
A factory to create an xtd::forms::timer. | |
static timer | create (const time_span &interval) |
A factory to create an xtd::forms::timer with specified interval. | |
static timer | create (const time_span &interval, bool enable) |
A factory to create an xtd::forms::timer with specified interval, and enable values. | |
static timer | create (int interval_milliseconds) |
A factory to create an xtd::forms::timer with specified interval. | |
static timer | create (int interval_milliseconds, bool enable) |
A factory to create an xtd::forms::timer with specified interval, and enable values. | |
Prootected methods | |
virtual void | on_tick (const event_args &e) |
Raises the xtd::forms::timer::tick event. | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<typename object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
Static Public Member Functions inherited from xtd::object | |
template<typename object_a_t , typename object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<typename object_a_t , typename object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
Protected Member Functions inherited from xtd::forms::component | |
component () | |
Initialises a new instance of the component class. | |
virtual bool | can_raise_events () const noexcept |
Gets a value indicating whether the component can raise an event. | |
bool | design_mode () const noexcept |
Gets a value that indicates whether the component is currently in design mode. | |
xtd::forms::timer::timer | ( | ) |
Initializes a new instance of the timer class.
|
virtualnoexcept |
Gets whether the timer is running.
|
virtual |
Sets whether the timer is running.
enabled | true if the timer is currently enabled; otherwise, false. The default is false. |
|
virtualnoexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
interval | An xtd::time_span specifying the interval before the tick event is raised relative to the last occurrence of the tick event. The value must be greater than zero. |
|
virtualnoexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
interval | An int32 specifying the number of milliseconds before the tick event is raised relative to the last occurrence of the tick event. The value cannot be less than one. |
void xtd::forms::timer::start | ( | ) |
Stops the timer.
void xtd::forms::timer::stop | ( | ) |
Starts the timer.
|
static |
A factory to create an xtd::forms::timer.
A factory to create an xtd::forms::timer with specified interval.
interval | An xtd::time_span specifying the interval before the tick event is raised relative to the last occurrence of the tick event. The value must be greater than zero. |
A factory to create an xtd::forms::timer with specified interval, and enable values.
interval | An xtd::time_span specifying the interval before the tick event is raised relative to the last occurrence of the tick event. The value must be greater than zero. |
enabled | true if the timer is currently enabled; otherwise, false. The default is false. |
|
static |
A factory to create an xtd::forms::timer with specified interval.
interval_milliseconds | An int32 specifying the number of milliseconds before the tick event is raised relative to the last occurrence of the tick event. The value cannot be less than one. |
|
static |
A factory to create an xtd::forms::timer with specified interval, and enable values.
interval_milliseconds | An int32 specifying the number of milliseconds before the tick event is raised relative to the last occurrence of the tick event. The value cannot be less than one. |
enabled | true if the timer is currently enabled; otherwise, false. The default is false. |
|
protectedvirtual |
Raises the xtd::forms::timer::tick event.
e | An event_args that contains the event data. This is always xtd::event_args::empty. |
event<timer, event_handler> xtd::forms::timer::tick |
Occurs when the specified timer interval has elapsed and the timer is enabled.