子程序优化

This commit is contained in:
2026-08-07 16:30:13 +08:00
parent 8daa1df8e9
commit a9355087ad
9 changed files with 408 additions and 10 deletions
@@ -568,16 +568,35 @@ namespace TestingModule.ViewModels
{
// 查找最近的未匹配循环开始
StepVM? lastUnmatchedLoopStart = null;
for (int i = Program.StepCollection.Count - 1; i >= 0; i--)
if (_ScopedContext.SelectedStepList == "主程序")
{
if (Program.StepCollection[i].StepType == "循环开始")
for (int i = Program.StepCollection.Count - 1; i >= 0; i--)
{
bool isMatched = Program.StepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
if (Program.StepCollection[i].StepType == "循环开始")
{
lastUnmatchedLoopStart = Program.StepCollection[i];
break;
bool isMatched = Program.StepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
{
lastUnmatchedLoopStart = Program.StepCollection[i];
break;
}
}
}
}
else
{
for (int i = Program.ErrorStepCollection.Count - 1; i >= 0; i--)
{
if (Program.ErrorStepCollection[i].StepType == "循环开始")
{
bool isMatched = Program.ErrorStepCollection.Any(s => s.StepType == "循环结束" && s.LoopStartStepId == Program.StepCollection[i].ID);
if (!isMatched)
{
lastUnmatchedLoopStart = Program.ErrorStepCollection[i];
break;
}
}
}
}