void OnActionCompleted(object sender, EventArgs e) { ActionQueueItem action = (ActionQueueItem)sender; action.Completed -= OnActionCompleted; if (Log.IsDebugEnabled) { Log.DebugFormat("OnActionCompleted {0}", action.Name); } IsBusy = false; RunNextAction(); }
public void QueueAction(ActionQueueItem action) { if (Log.IsDebugEnabled) { Log.DebugFormat("QueueAction {0}", action.Name); } _queue.Enqueue(action); if (!IsBusy) { RunNextAction(); } }
void RunNextAction() { if (_queue.Count > 0) { IsBusy = true; ActionQueueItem action = _queue.Dequeue(); if (Log.IsDebugEnabled) { Log.DebugFormat("RunNextAction {0}", action.Name); } action.Completed += OnActionCompleted; action.Run(); } }
public void QueueAction(ActionQueueItem action) { if (Log.IsDebugEnabled) Log.DebugFormat("QueueAction {0}", action.Name); _queue.Enqueue(action); if (!IsBusy) { RunNextAction(); } }