private void Runner_ExecutionStateChanged(object sender, ExecutionStateChangedEventArgs e) { App.Current.Dispatcher.Invoke(() => { switch (e.ExecutionState) { case ExecutionState.Stopped: ProgramCode.HighlightedLineNumber = 0; ProgramInteraction.HideInputPrompt(); break; case ExecutionState.Paused: if (SingleStepMode) { ProgramCode.HighlightedLineNumber = runner.LineNumber; ProgramInteraction.HideInputPrompt(); } else { // Want to run at full speed runner.ExecuteNextLine(); } break; case ExecutionState.Running: if (SingleStepMode) { ProgramCode.HighlightedLineNumber = 0; ProgramInteraction.HideInputPrompt(); } break; case ExecutionState.WaitingForInput: ProgramInteraction.ShowInputPrompt(!string.IsNullOrWhiteSpace(runner.Prompt) ? runner.Prompt : "Please enter your response:"); if (SingleStepMode) { ProgramCode.HighlightedLineNumber = runner.LineNumber; } break; } OnPropertyChanged(nameof(ExecutionState)); GoCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); }); }