ITimeManager
Interface for time management, providing sleep, stopwatch, and task scheduling capabilities.
Namespace: ControlBee.Interfaces
Extends: IDisposable
Properties
| Name | Type | Description |
|---|---|---|
CurrentMilliseconds | int | The current time in milliseconds. |
Methods
Sleep
Pauses the current thread for the specified duration.
void Sleep(int millisecondsTimeout);
Parameters:
millisecondsTimeout— The duration to sleep in milliseconds.
CreateWatch
Creates a new stopwatch instance.
IStopwatch CreateWatch();
Returns: A new IStopwatch instance.
Register
Registers the current thread with the time manager.
void Register();
Unregister
Unregisters the current thread from the time manager.
void Unregister();
RunTask
Runs an action asynchronously.
Task RunTask(Action action);
Task<T> RunTask<T>(Func<T> func);
Returns: A Task representing the asynchronous operation.
Events
CurrentTimeChanged
Raised when the current time changes.
event EventHandler<int> CurrentTimeChanged;