/// <summary> /// 执行这条指令 /// </summary> public void Dash() { // 构造参数字典 var ArgDict = this.ArgumentList.ToDictionary(kvp => kvp.Key, kvp => new ArgumentPackage() { aType = kvp.Value.Key, valueExp = kvp.Value.Value }); // 构造新的动作包装 ActionPackage ap = new ActionPackage() { indent = this.indent, argsDict = ArgDict, nodeName = String.Format("{0}@{1}", this.commandLine, this.apType), nodeType = this.apType }; // 缓存编辑前的动作 this.LastAP = this.parent.GetAction(this.commandLine); // 更新后台 this.parent.ReplaceAction(ap, this.commandLine); // 更新前端 HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap.indent, String.Format("◆{0}{1}{2}", ap.GetActionName(), ap.GetSpace(), ap.GetParaDescription())); }
/// <summary> /// 撤销这条指令 /// </summary> public void Undo() { // 更新后台 this.parent.ReplaceAction(this.LastAP, this.commandLine); // 更新前端 HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); HalationViewCommand.AddItemToCodeListbox(this.commandLine, this.LastAP.indent, String.Format("◆{0}{1}{2}", this.LastAP.GetActionName(), this.LastAP.GetSpace(), this.LastAP.GetParaDescription())); }
/// <summary> /// 重载撤销命令 /// </summary> public void Undo() { // 这里没错,因为删除后下标变化了 for (int i = 0; i < 3; i++) { this.parent.DeleteAction(this.commandLine); HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); } }
/// <summary> /// 重载撤销命令 /// </summary> public void Undo() { // 这里没错,因为删除后下标变化了 int bound = this.isContainElse ? 5 : 3; for (int i = 0; i < bound; i++) { this.parent.DeleteAction(this.commandLine); HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); } }
/// <summary> /// 重载执行命令 /// </summary> public void Dash() { // IF节点 Dictionary <string, ArgumentPackage> ifArgDict = new Dictionary <string, ArgumentPackage>(); ifArgDict.Add("op1", new ArgumentPackage() { aType = ArgType.unknown, valueExp = this.operand1 }); ifArgDict.Add("op2", new ArgumentPackage() { aType = ArgType.unknown, valueExp = this.operand2 }); ifArgDict.Add("opr", new ArgumentPackage() { aType = ArgType.unknown, valueExp = this.operateMode }); ifArgDict.Add("expr", new ArgumentPackage() { aType = ArgType.unknown, valueExp = this.condExpr }); ifArgDict.Add("?elseflag", new ArgumentPackage() { aType = ArgType.unknown, valueExp = this.isContainElse.ToString() }); ActionPackage ap1 = new ActionPackage() { indent = this.indent, argsDict = ifArgDict, nodeName = String.Format("{0}@{1}", this.commandLine, ActionPackageType.act_if.ToString()), nodeType = ActionPackageType.act_if }; // 缓存编辑前的动作 this.LastAP = this.parent.GetAction(this.commandLine); // 更新后台 this.parent.ReplaceAction(ap1, this.commandLine); // 更新前端 HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap1.indent, String.Format("◆{0}{1}{2}", ap1.GetActionName(), ap1.GetSpace(), ap1.GetParaDescription())); }
/// <summary> /// 撤销这条指令 /// </summary> public void Undo() { this.parent.DeleteAction(this.commandLine); HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine); }