Esempio n. 1
0
        internal void DoWork(DispatcherTiming timing)
        {
            var work = GetWork(timing).ToList();

            foreach (var action in work)
            {
                action();
            }
        }
Esempio n. 2
0
        private IEnumerable <Action> GetWork(DispatcherTiming timing)
        {
            var queue = _queues[timing];

            while (!queue.IsEmpty)
            {
                if (queue.TryDequeue(out var action))
                {
                    yield return(action);
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 3
0
 public void Invoke(Action action, DispatcherTiming timing = DispatcherTiming.Update)
 {
     _queues[timing].Enqueue(action);
 }