Пример #1
0
 private void supprimeAction(ActionDifferee action)
 {
     lock (_actions)
     {
         for (int i = 0; i < _actions.Count; i++)
         {
             if (action == _actions[i].action)
             {
                 _actions.RemoveAt(i);
                 break;
             }
         }
     }
 }
Пример #2
0
 public ActionDifferee Pop()
 {
     if (_actions.Count > 0)
     {
         lock (_actions)
         {
             ActionDifferee action = _actions[0].action;
             _actions.RemoveAt(0);
             return(action);
         }
     }
     else
     {
         return(null);
     }
 }
Пример #3
0
        public void ajoute(ActionDifferee action, PRIORITE priorite = PRIORITE.MOYENNE)
        {
            action.dansLaQueue();
            lock (_actions)
            {
                int indice = 0;
                while (indice < _actions.Count)
                {
                    if (_actions[indice].priorite < priorite)
                    {
                        break;
                    }
                    indice++;
                }


                ActionPriorite p = new ActionPriorite(priorite, action);
                if (indice < _actions.Count)
                {
                    _actions.Insert(indice, p);
                }
                else
                {
                    _actions.Add(p);
                }
            }

            SetStatusFilmATraiter($"{_actions.Count} actions à traiter");
            if (_bgw == null)
            {
                _bgw = new BackgroundWorker();
                _bgw.WorkerSupportsCancellation = true;
                _bgw.ProgressChanged           += progressChanged;
                _bgw.WorkerReportsProgress      = true;
                _bgw.DoWork += doWork;

                _bgw.RunWorkerAsync();
            }
        }
Пример #4
0
 public ActionPriorite(PRIORITE p, ActionDifferee a)
 {
     priorite = p;
     action   = a;
 }