public override void execute() { TextMenu menu = new TextMenu(); int index = 1; while (true) { Statement program = getProgram(index); if (program == null) { break; } menu.addCommand(new ChooseExampleCommand( "" + index, "Choose example " + index + "\n " + program, controller, program, "./logs/log" + index + ".txt") ); ++index; } menu.addCommand(new ExitCommand("0", "Exit submenu")); menu.show(); }
public static void Main(string[] args) { TextMenu menu = new TextMenu(); Repository repository = new SingleProgramStateRepository("./logs/alllogs.txt"); Controller controller = new Controller(repository); menu.addCommand(new ChooseProgramCommand("1", "Choose program", controller)); menu.addCommand(new ExecuteOneStepCommand("2", "Execute one step of the current program", controller)); menu.addCommand(new ExecuteAllStepsCommand("3", "Execute all steps of the current program", controller)); menu.addCommand(new ExitCommand("0", "Exit")); menu.show(); }