Exemplo n.º 1
0
        /// <summary>
        ///     添加新命令并执行之
        /// </summary>
        /// <param name="command"></param>
        public ICommandPattern AddCommand(ICommandPattern command)
        {
            var commandNode = new LinkedListNode <ICommandPattern>(command);

            if (CurrentCommand != null)
            {
                Commands.AddAfter(CurrentCommand, commandNode);
            }
            else
            {
                Commands.AddFirst(commandNode);
            }
            CurrentCommand = commandNode;
            return(command);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加新命令并执行之
        /// </summary>
        /// <param name="command"></param>
        public void AddCommand(BaseCommand command)
        {
            LinkedListNode <BaseCommand> commandNode = new LinkedListNode <BaseCommand>(command);

            if (CurCommand != null)
            {
                Commands.AddAfter(CurCommand, commandNode);
            }
            else
            {
                Commands.AddFirst(commandNode);
            }
            CurCommand = commandNode;

            ///断掉commandNode之后结点
            Commands.RemoveAfter(commandNode);
        }