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;
            }
        }
Esempio n. 3
0
 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");
        }
Esempio n. 7
0
 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 */
                    }
                }
            }
        }
Esempio n. 9
0
 public void RegisterLoopes(ILoopable L)
 {
     _RegisteredLoopes.Add(L);
 }
Esempio n. 10
0
 public void RegisterLoops(ILoopable l)
 {
     _RegisteredLoops.Add(l);
 }
Esempio n. 11
0
 public void DeregisterLoops(ILoopable l)
 {
     _RegisteredLoops.Remove(l);
 }
Esempio n. 12
0
 // Deregister Loops
 public void DeRegisterLoops(ILoopable _l)
 {
     this.registeredLoops.Remove(_l);
 }
Esempio n. 13
0
 // Register Loops
 public void RegisterLoops(ILoopable _l)
 {
     this.registeredLoops.Add(_l);
 }
Esempio n. 14
0
 public PeriodicThread(int periodMs, IProcessable processable, ILoopable loopable)
 {
     _periodMs    = periodMs;
     _processable = processable;
     _loopable    = loopable;
 }
Esempio n. 15
0
 /// <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);
 }
Esempio n. 16
0
 public MainLoop(ILoopable obj, int loopTime)
 {
     Object   = obj;
     LoopTime = loopTime;
 }
Esempio n. 17
0
 /// <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);
 }
Esempio n. 18
0
 public void DeRegisterLoopes(ILoopable i)
 {
     _RegisteredLoopes.Remove(i);
 }
Esempio n. 19
0
 public void Add(ILoopable aLoop)
 {
     _loops.Add(aLoop);
 }