public void StartAll() { for (int i = 0; i < _loops.Count; ++i) { ILoopable lp = (ILoopable)_loops[i]; lp.OnStart(); _enabs[i] = true; } }
public void StopAll() { for (int i = 0; i < _loops.Count; ++i) { ILoopable lp = (ILoopable)_loops[i]; lp.OnStop(); _enabs[i] = false; } }
public void Add(ILoopable newLoop) { foreach (var loop in _loops) { if (loop == newLoop) { return; /* already here */ } } _loops.Add(newLoop); _enabs.Add(true); }
public void Start(ILoopable toStart) { for (int i = 0; i < _loops.Count; ++i) { ILoopable lp = (ILoopable)_loops[i]; if (lp == toStart) { lp.OnStart(); _enabs[i] = true; return; } } Debug.Print("CTR: Could not find object in scheduler"); }
public void Add(ILoopable newLoop, bool bEnabled = true) { foreach (var loop in _loops) { if (loop == newLoop) { return; /* already here */ } } _loops.Add(newLoop); _enabs.Add(bEnabled); /* call the start routine now, and next process call will be it's first process */ if (bEnabled) { Start(newLoop); } }
public void Stop(ILoopable toStart) { for (int i = 0; i < _loops.Count; ++i) { ILoopable lp = (ILoopable)_loops[i]; bool en = (bool)_enabs[i]; if (lp == toStart) { if (en == true) { lp.OnStop(); _enabs[i] = false; } return; } } Debug.Print("CTR: Could not find object in scheduler"); }
public void Process() { if (_idx < _loops.Count) { if (_running && _timeout.Process()) { ILoopable loop = (ILoopable)_loops[_idx]; loop.OnLoop(); if (loop.IsDone()) { ++_idx; } } } else { _running = false; } }
public void Process() { if (_timeout.Process()) { for (int i = 0; i < _loops.Count; ++i) { ILoopable lp = (ILoopable)_loops[i]; bool en = (bool)_enabs[i]; if (en) { lp.OnLoop(); } else { /* this loopable is turned off, don't call it */ } } } }
public void RegisterLoopes(ILoopable L) { _RegisteredLoopes.Add(L); }
public void RegisterLoops(ILoopable l) { _RegisteredLoops.Add(l); }
public void DeregisterLoops(ILoopable l) { _RegisteredLoops.Remove(l); }
// Deregister Loops public void DeRegisterLoops(ILoopable _l) { this.registeredLoops.Remove(_l); }
// Register Loops public void RegisterLoops(ILoopable _l) { this.registeredLoops.Add(_l); }
public PeriodicThread(int periodMs, IProcessable processable, ILoopable loopable) { _periodMs = periodMs; _processable = processable; _loopable = loopable; }
/// <summary> /// If this class is not inherited the caller can initialize the instance here. /// </summary> /// <param name="loopable"></param> public LoopThread(ILoopable loopable) { Initialize(loopable); }
public MainLoop(ILoopable obj, int loopTime) { Object = obj; LoopTime = loopTime; }
/// <summary> /// Inherited class must initialize the base class with this method. /// </summary> /// <param name="loopable"></param> protected void Initialize(ILoopable loopable) { _loopable = loopable; Thread = new WorkerThread(Start); }
public void DeRegisterLoopes(ILoopable i) { _RegisteredLoopes.Remove(i); }
public void Add(ILoopable aLoop) { _loops.Add(aLoop); }