Beispiel #1
0
 public override void OnChildDone(CommandBase child)
 {
     if (child == this._selectWork)
     {
         if (this._selectWork.State == CmdExecuteState.Success)
         {
             if (_succeedWork != null)
             {
                 _succeedWork.Execute(_context);
             }
             else
             {
                 this.OnExecuteDone(CmdExecuteState.Success);
             }
         }
         else
         {
             if (_failWork != null)
             {
                 _failWork.Execute(_context);
             }
             else
             {
                 this.OnExecuteDone(CmdExecuteState.Success);
             }
         }
     }
     else
     {
         this.OnExecuteDone(child.State);
     }
 }
 /// <summary>
 /// 添加子命令并直接执行
 /// </summary>
 /// <param name="command">Command.</param>
 public override void AddSubCommand(CommandBase command)
 {
     command.Parent = this;
     _children.AddLast(command);
     this.OnChildStart(command);
     command.Execute(_context);
 }
Beispiel #3
0
 protected virtual void Next()
 {
     if (_children.Count > 0)
     {
         _executeChild = _children.First.Value;
         _children.RemoveFirst();
         this.OnChildStart(_executeChild);
         _executeChild.Execute(this._context);
     }
     else
     {
         this.OnExecuteDone(CmdExecuteState.Success);
     }
 }
Beispiel #4
0
 public override void Execute(ICommandContext context)
 {
     base.Execute(context);
     _selectWork.Execute(context);
 }