public void NextCommand() { var command = GetCommand(lines[cursor]); switch (command) { case "gesture": var r = new Regex(@"^gesture\s+\*(\w+)\s*,\s*\*(\w+)$"); var m = r.Match(lines[cursor]); if (m.Groups.Count == 3) { yesLabel = m.Groups[1].ToString(); noLabel = m.Groups[2].ToString(); state = State.WaitingYesNo; return; } throw new Exception("Syntax error"); case "delay": r = new Regex(@"^delay\s+(\d+)$"); m = r.Match(lines[cursor]); if (m.Groups.Count == 2) { cursor++; var time = int.Parse(m.Groups[1].ToString()); Invoke(nameof(NextCommand), time / 1000f); return; } throw new Exception("Syntax error"); case "goto": r = new Regex(@"^goto\s+\*(\w+)$"); m = r.Match(lines[cursor]); if (m.Groups.Count == 2) { var label = m.Groups[1].ToString(); GoTo(label); return; } throw new Exception("Syntax error"); } var message = ""; while (GetCommand(lines[cursor]) == "") { string line = lines[cursor]; if (line != "") { message += line + "\n"; } cursor++; } ShowMessageHandler?.Invoke(message); }
public void DisplayMessage(string TabName) { if (this.Msg_Box.InvokeRequired) { ShowMessageHandler smh = new ShowMessageHandler(ShowMessage); smh.Invoke(TabName); } else { ShowMessage(TabName); } }