public void AppendText(string Text, bool Force = false) { if (IsPaused && !Force) { return; } if (InitialMessageDisplayed) { InitialMessageDisplayed = false; AppTextBox.Text = string.Empty; } // handoff to Dispatcher at normal priority // to allow for UI thread access Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (IsSimulationMode) { if (LineNum is 0) { AppTextBox.AppendText($"Simulation started...\n"); } else { AppTextBox.AppendText($"Line number: {LineNum} of {JSONTextLines.Count}:\n"); } } Text = $"{Text}\n"; AppTextBox.AppendText(Text); AppTextBox.ScrollToEnd(); })); }
private void EndSimulationMode() { if (SimulationTimer != null) { SimulationTimer.StopTimer(); SimulationTimer = null; } AppTextBox.AppendText($"\nSimulation ended at {LineNum} lines of {JSONTextLines.Count}\n"); StartButton.Content = "Go"; SimulationModeStarted = false; IsSimulationMode = false; }