private void AddScriptResult(ScriptHandler.ScriptResult result) { HistoryText.Document.Blocks.Add(new Paragraph(new Run(result.Result))); if (result.IsError) { TextRange tr = new TextRange(HistoryText.Document.Blocks.LastBlock.ContentStart, HistoryText.Document.Blocks.LastBlock.ContentEnd); tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red); } HistoryText.Visibility = Visibility.Visible; }
private void ScriptHandler_ScriptResultReceived(object sender, ScriptHandler.ScriptResult e) { Dispatcher.Invoke(() => AddScriptResult(e)); }