Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Objects.Tasks.IterativeTask Class Reference
Inheritance diagram for pluginbase.Objects.Tasks.IterativeTask:
pluginbase.Objects.Tasks.ITask

Public Member Functions

 IterativeTask (Func< int, TaskResult > method)
 
 IterativeTask (IIterableSystem system)
 
TaskResult InvokeTask (long maxMilliseconds)
 
override string ToString ()
 

Properties

TimeSpan Frequency [get]
 
- Properties inherited from pluginbase.Objects.Tasks.ITask
TimeSpan Frequency [get]
 

Constructor & Destructor Documentation

pluginbase.Objects.Tasks.IterativeTask.IterativeTask ( Func< int, TaskResult method)
13  {
14  _method = method;
15  }
pluginbase.Objects.Tasks.IterativeTask.IterativeTask ( IIterableSystem  system)
18  {
19  _method = system.Iterate;
20  }

Member Function Documentation

TaskResult pluginbase.Objects.Tasks.IterativeTask.InvokeTask ( long  maxMilliseconds)

Implements pluginbase.Objects.Tasks.ITask.

24  {
25  var sw = new Stopwatch();
26  sw.Start();
27  while (sw.ElapsedMilliseconds < maxMilliseconds)
28  {
29  if (_method(_runCount) == TaskResult.Remove)
30  {
31  return TaskResult.Remove;
32  }
33  _runCount++;
34  }
35  sw.Stop();
36  return TaskResult.Continue;
37  }
TaskResult
The result of a scheduled task
Definition: TaskResult.cs:8
override string pluginbase.Objects.Tasks.IterativeTask.ToString ( )
46  {
47  return string.Format("[IterativeTask: Frequency={0}, {1}]", Frequency, _method.Method.Name);
48  }
TimeSpan Frequency
Definition: IterativeTask.cs:39

Property Documentation

TimeSpan pluginbase.Objects.Tasks.IterativeTask.Frequency
get

The documentation for this class was generated from the following file: