private void RunButton_Click(object sender, RoutedEventArgs e) { if (Settings.RunFunction == Settings.RunFunctionMap["Run"]) { if (CanRun()) { RunProgram(); return; } } if (Settings.RunFunction == Settings.RunFunctionMap["Step"]) { if (Settings.Running && Settings.IterationType == "Once") { Interpret.IterateOnce(); return; } } if (Settings.RunFunction == Settings.RunFunctionMap["Stop"]) { AttemptStop(); return; } if (Settings.RunFunction == Settings.RunFunctionMap["Reset"]) { ResetProgram(); return; } }
private void IteratorDone(object sender, RunWorkerCompletedEventArgs e) { if (Settings.IterationType == "Delay") { if (Settings.Running) { Interpret.IterateOnce(); Iterator.RunWorkerAsync(); } else { SetRunToReset(); SetOptionsToOptions(); } } }
public void RunProgram() { if (!Settings.Running) { Interpret.ProgramInput(EditorTextBox.Text); DisableEdit(); } if (Settings.IterationType == "Delay") { Settings.CanReset = true; Settings.Running = true; SetRunToStop(); Iterator.RunWorkerAsync(); } if (Settings.IterationType == "Once") { Settings.CanReset = true; Settings.Running = true; SetRunToStep(); SetOptionsToReset(); Settings.RunFunction = Settings.RunFunctionMap["Step"]; Interpret.IterateOnce(); } if (Settings.IterationType == "End") { Settings.CanReset = true; Settings.Running = true; SetRunToStop(); RunFull.RunWorkerAsync(); RunFullUpdate.RunWorkerAsync(); RunButton.Background = new SolidColorBrush(); } if (Settings.IterationType == "Label") { Interpret.Break.BreakLabel = Settings.BreakLabel; Interpret.Break.BreakOnLabel = true; Settings.CanReset = true; Settings.Running = true; SetRunToStop(); RunFull.RunWorkerAsync(); RunFullUpdate.RunWorkerAsync(); RunButton.Background = new SolidColorBrush(); } }