Constructor: PeriodicTask(action, periodMilliseconds, excutingNode)

A
PeriodicTask
task runs code at regular time intervals.
PeriodicTask(Action action, int periodMilliseconds, IUANode executingNode);

Arguments

action
(Action)
The method or lambda expression to run.
periodMilliseconds
(int)
The time between the method or lambda expression is ran.
executingNode
(IUANode)
The node in which the code is ran.

Example

The
myPeriodicTask
task  runs the
IncrementVariable()
method every second (1000 milliseconds). The method increments the value of the
variable1
variable by one unit each time it is ran.
public override void Start() { myPeriodicTask = new PeriodicTask(IncrementVariable, 1000, LogicObject); myPeriodicTask.Start(); } public override void Stop() { myPeriodicTask.Dispose(); } private void IncrementVariable() { variable1.Value = variable1.Value + 1; } private PeriodicTask myPeriodicTask;
MANCIA: In this example, the
IncrementVariable()
method has no
PeriodicTask
argument because the simplicity of its code does not require the task to be canceled.
Fornire un feedback
Hai domande o feedback su questa documentazione? invia il tuo feedback qui.