Constructor: DelayedTask(action, delayMilliseconds, executingNode)

A
DelayedTask
task runs code after a given time interval.
DelayedTask(Action action, int delayMilliseconds, IUANode executingNode);

Arguments

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

Example

The
myDelayedTask
task runs the
ResetLabelText()
method after 10 seconds (10000 milliseconds). The method cancels the text of the
label1
label.
public override void Start() { myDelayedTask = new DelayedTask(ResetLabelText, 10000, LogicObject); myDelayedTask.Start(); } public override void Stop() { myDelayedTask.Dispose(); } private void ResetLabelText() { label1.Text = string.Empty; } private DelayedTask myDelayedTask;
TIP: In this example, the
ResetLabelText()
method has no
DelayedTask
argument. The simplicity of its code does not require the task to be canceled.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.