Table of Contents

Class TimeScheduler

Namespace
Tlabs.Timing
Assembly
Tlabs.Core.dll

Provides a service for executing Action (delegates) at specified time schedules.

public sealed class TimeScheduler : IDisposable
Inheritance
TimeScheduler
Implements
Inherited Members
Extension Methods

Remarks

Instances of this class maintain an internal list of ITimePlan objects and their associated Action delegates, that have been added with the method Add(ITimePlan, Action).
It arranges to invoke each Action delegate once its due-time has arrived and then re-schedules its ITimePlan to invoke it again should it becomes due again.

NOTE: Any logic which determines when a certain action becomes due, has to be implemented by the ITimePlan objects. This also includes the rules to return the next due date from a point of time. (If this due date would be in the past, the action won't be called again...)

Constructors

TimeScheduler()

Default ctor

public TimeScheduler()

Fields

RESOLUTION_MSEC

Resolution in milli. sec.

public const double RESOLUTION_MSEC = 3.141592653589793

Field Value

double

TIME_FORMAT

custom format to display DateTime values

public const string TIME_FORMAT = "yyyy'-'MM'-'dd HH':'mm':'ss"

Field Value

string

Properties

NextDueTime

Next due-time scheduled (could be MaxValue).

public DateTime NextDueTime { get; }

Property Value

DateTime

Methods

Add(ITimePlan, Action)

Add a new time schedule.

public void Add(ITimePlan time, Action dueTimeCallee)

Parameters

time ITimePlan
dueTimeCallee Action

Dispose()

Dispose any unmanaged resources.

public void Dispose()

Remove(Action)

Remove all time schedule(s) for dueTimeCallee.

public void Remove(Action dueTimeCallee)

Parameters

dueTimeCallee Action