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 | |
| xtd::event< timer, xtd::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 auto | enabled () const noexcept -> bool |
| Gets whether the timer is running. | |
| virtual auto | enabled (bool value) -> timer & |
| Sets whether the timer is running. | |
| virtual auto | interval () const noexcept -> xtd::time_span |
| Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
| virtual auto | interval (const xtd::time_span &value) -> timer & |
| Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
| virtual auto | interval_milliseconds () const noexcept -> xtd::int32 |
| Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
| virtual auto | interval_milliseconds (xtd::int32 value) -> timer & |
| Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event. | |
Public Methods | |
| auto | start () -> void |
| Stops the timer. | |
| auto | stop () -> void |
| Starts the timer. | |
Public Static Methods | |
| static auto | create () -> timer |
| A factory to create an xtd::forms::timer. | |
| static auto | create (const xtd::time_span &interval) -> timer |
| A factory to create an xtd::forms::timer with specified interval. | |
| static auto | create (const xtd::time_span &interval, bool enable) -> timer |
| A factory to create an xtd::forms::timer with specified interval, and enable values. | |
| static auto | create (xtd::int32 interval_milliseconds) -> timer |
| A factory to create an xtd::forms::timer with specified interval. | |
| static auto | create (xtd::int32 interval_milliseconds, bool enable) -> timer |
| A factory to create an xtd::forms::timer with specified interval, and enable values. | |
Prootected methods | |
| virtual auto | on_tick (const xtd::event_args &e) -> void |
| Raises the xtd::forms::timer::tick event. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | equals (const object &obj) const noexcept -> bool |
| Determines whether the specified object is equal to the current object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | to_string () const -> xtd::string |
| Returns a xtd::string that represents the current object. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| component () | |
| Initialises a new instance of the component class. | |
| virtual auto | can_raise_events () const noexcept -> bool |
| Gets a value indicating whether the component can raise an event. | |
| auto | design_mode () const noexcept -> bool |
| 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.
|
nodiscardvirtualnoexcept |
Gets whether the timer is running.
|
virtual |
Sets whether the timer is running.
| value | true if the timer is currently enabled; otherwise, false. The default is false. |
|
nodiscardvirtualnoexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
|
virtual |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
| value | 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. |
|
nodiscardvirtualnoexcept |
Gets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
|
virtual |
Sets the time, in milliseconds, before the tick event is raised relative to the last occurrence of the tick event.
| value | 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. |
| auto xtd::forms::timer::start | ( | ) | -> void |
Stops the timer.
| auto xtd::forms::timer::stop | ( | ) | -> void |
Starts the timer.
|
staticnodiscard |
A factory to create an xtd::forms::timer.
|
staticnodiscard |
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. |
|
staticnodiscard |
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. |
|
staticnodiscard |
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. |
|
staticnodiscard |
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. |
| xtd::event<timer, xtd::event_handler> xtd::forms::timer::tick |
Occurs when the specified timer interval has elapsed and the timer is enabled.