/// <summary> /// 初始化第一条命令 /// </summary> /// <param name="command">当前命令</param> private void InitFirstCommand(FlowChartBaseCommand command) { if (commandIndex == -1) // 检查是否是第一条命令 { command.FirstCommand = true; } }
/// <summary> /// 调整命令链表 /// </summary> /// <param name="cmd">当前命令</param> private void AdjustCommandList(FlowChartBaseCommand cmd) { if (flowChartManager.SupportCommand) { List<FlowChartBaseCommand> deleteCommandList = new List<FlowChartBaseCommand>(); // 要删除的命令的链表 for (int i = commandIndex + 1; i < commandList.Count; i++) { deleteCommandList.Add(commandList[i]); } // 删除被覆盖的命令 foreach (FlowChartBaseCommand command in deleteCommandList) { commandList.Remove(command); } documentManager.AdjustCommandList(commandIndex, string.Format("撤销 ({0} {1})", DateTime.Now, cmd.Description), commandList.Count); // 添加新命令 commandList.Add(cmd); commandIndex++; } }