Esempio n. 1
0
    override public void oneLoop()
    {
        int timeIntervalToNextLoop = 0;

        lock (_excutableList) {
            if (_excutableList.Count != 0)
            {
                traversalAndExcute(true);
            }

            if (_excutableList.Count > 0)
            {
                OnTimeExecution execution = (OnTimeExecution)_excutableList[0];
                if (execution != null)
                {
                    timeIntervalToNextLoop = (int)(execution.when() - ApplicationEX.GetCurrnSystemMillisecond());
                }
            }

            maualResetEvent.Reset();
        }

        if (timeIntervalToNextLoop > 0)
        {
            maualResetEvent.WaitOne(timeIntervalToNextLoop);
        }
        else
        {
            maualResetEvent.WaitOne();
        }
    }
Esempio n. 2
0
    public void addExcutable(OnTimeExecution excutable)
    {
        lock (_excutableList) {
            bool inserted = false;

            //sort by time asc.
            for (int i = 0; i < _excutableList.Count; i++)
            {
                if (excutable.when() < ((OnTimeExecution)_excutableList[i]).when())
                {
                    _excutableList.Insert(i, excutable);
                    inserted = true;
                    break;
                }
            }

            if (inserted == false)
            {
                _excutableList.Add(excutable);
            }

            maualResetEvent.Set();
        }
    }
Esempio n. 3
0
 public void removeExecution(OnTimeExecution execution)
 {
     _Loop.removeExcutable(execution);
 }
Esempio n. 4
0
 public void removeExcutable(OnTimeExecution excutable)
 {
     lock (_excutableList) {
         _excutableList.Remove(excutable);
     }
 }
Esempio n. 5
0
 public void addExecution(OnTimeExecution execution)
 {
     _Loop.addExcutable(execution);
 }