Пример #1
0
        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();
        }
Пример #2
0
        public void QueueAction(ActionQueueItem action)
        {
            if (Log.IsDebugEnabled)
            {
                Log.DebugFormat("QueueAction {0}", action.Name);
            }

            _queue.Enqueue(action);

            if (!IsBusy)
            {
                RunNextAction();
            }
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
        public void QueueAction(ActionQueueItem action)
        {
            if (Log.IsDebugEnabled)
                Log.DebugFormat("QueueAction {0}", action.Name);

            _queue.Enqueue(action);

            if (!IsBusy)
            {
                RunNextAction();
            }
        }