public void ExecuteOneStep() { if (interruptions is null) { interruptions = RootNode.Execute().GetEnumerator(); ProgramEnded = false; } if (ProgramEnded) { DetailForm.ShowError("Program end!"); return; } if (interruptions.MoveNext()) { Interruption interruption = interruptions.Current; DetailForm.ShowRectangles(interruption.Position.ID, false); if (interruption.Type != "pause") { DetailForm.ShowError(interruption.Type); } } else { ProgramEnded = true; DetailForm.HideAllRectangles(); } UpdateVisualizer(); }
public void ExecuteToEnd() { if (interruptions is null) { interruptions = RootNode.Execute().GetEnumerator(); ProgramEnded = false; } if (ProgramEnded) { DetailForm.ShowError("Program end!"); return; } List <int> breakPoints = DetailForm.GetBreakLines(); bool broke = false; while (interruptions.MoveNext()) { Interruption interruption = interruptions.Current; if (interruption.Type != "pause") { DetailForm.ShowRectangles(interruption.Position.ID, false); DetailForm.ShowError(interruption.Type); broke = true; break; } else if (breakPoints.Contains(interruption.Position.RawNode.LineNumber)) { DetailForm.ShowRectangles(interruption.Position.ID, false); broke = true; break; } } if (!broke) { ProgramEnded = true; DetailForm.HideAllRectangles(); } UpdateVisualizer(); }