Exemplo n.º 1
0
 public void Cancell()
 {
     lock (_lockobject)
     {
         _cancelled = true;
         _state = DepState.DepPause;
     }
 }
Exemplo n.º 2
0
 public void Begin(int vol)
 {
     lock (_lockobject)
     {
         _volume = vol;
         _currVol = 0;
         _state = DepState.DepStart;
     }
 }
Exemplo n.º 3
0
 public void Work()
 {
     while (_bContinue)
     {
         switch (_state)
         {
             case DepState.DepStart:
                 if(CanStart())
                   _state = DepState.DepWork;
                 break;
             case DepState.DepAbort:
                 _state = DepState.DepWait;
                 break;
             
             case DepState.DepWork:
                 GetCurrVol();
                 _context.Send(OnDepChanged, _currVol);
                 if (_currVol >= _volume)
                 {
                     DoEnd(_currVol);
                     _state = DepState.DepWait;
                 }
                 //_context.Send(OnWorkCompleted, _cancelled);
                 break;
             
             case DepState.DepPause:
     //            _context.Send(OnWorkCompleted, _cancelled);
                 break;
         }
     }
 }
Exemplo n.º 4
0
 public void Continue(int currV)
 {
     _state = DepState.DepWork;
 }
Exemplo n.º 5
0
        public void Abort(int currV)
        {
            DoEnd(_currVol);
            _state = DepState.DepWait;

        }
Exemplo n.º 6
0
 public DepLogic(SynchronizationContext context) : this(0, 0, 0)
 {
     _state = DepState.DepWait;
     _context = context;
     _bContinue = true;
 }