Example #1
0
        /// <summary>
        /// Executes the command that is dequeued from queue.
        /// </summary>
        protected void ExecuteCommand()
        {
            if (m_queue == null)
            {
                return;
            }

            if (m_queue.Count > 0)
            {
                ICommand command = m_queue.Dequeue();

                if (command != null)
                {
                    command.AddEventListener(CommandEvent.Error, OnCommandError);
                    command.AddEventListener(CommandEvent.Executed, OnCommandExecuted);
                    command.Execute();
                }
            }
            else
            {
                DispatchEvent(new CommandQueueEvent(CommandQueueEvent.Complete));
                Reset();
            }
        }