Example #1
0
 //
 #endregion
 //-------------------------------------------------------------------------
 #region Public
 //
 public bool Run(bool enable, int msec)
 {
     if (!enable)
     {
         _outValue = false;
         hTimer.Reset();
         startTime = hTimer.GetStartTime();
         timeLeft  = 0;
         _enable   = false;
         return(false);
     }
     //
     if (_outValue)
     {
         return(true);
     }
     //
     timeLeft = hTimer.GetTimeLeftMs(startTime);
     if (!_enable)
     {
         _enable = enable;
         if (startTime <= 0)
         {
             startTime = hTimer.GetStartTime();
         }
         return(false);
     }
     _enable = enable;
     //
     if (timeLeft >= msec)
     {
         _outValue = true;
     }
     //
     return(_outValue);
 }
Example #2
0
 public CTOn()
 {
     hTimer = new HiPerfTimer();
     hTimer.Reset();
     hTimer.Start();
 }