internal void DoWork(DispatcherTiming timing) { var work = GetWork(timing).ToList(); foreach (var action in work) { action(); } }
private IEnumerable <Action> GetWork(DispatcherTiming timing) { var queue = _queues[timing]; while (!queue.IsEmpty) { if (queue.TryDequeue(out var action)) { yield return(action); } else { break; } } }
public void Invoke(Action action, DispatcherTiming timing = DispatcherTiming.Update) { _queues[timing].Enqueue(action); }