private void IAddEvent(TraceEvent te) { var p = new Paragraph { TextAlignment = TextAlignment.Left, Margin = new Thickness(0), Inlines = { //new Line() { X1 = 0, X2 = 40, Y1 = -4, Y2 = -4, StrokeThickness = 2, Stroke = TurnBrush }, new Run(te.ToString()) {Foreground = _turnBrush, FontWeight = FontWeights.Bold} //new Line() { X1 = 0, X2 = 40, Y1 = -4, Y2 = -4, StrokeThickness = 2, Stroke = TurnBrush } } }; if (output.Document.Blocks.LastBlock != null) if (((Paragraph) output.Document.Blocks.LastBlock).Inlines.Count == 0) output.Document.Blocks.Remove(output.Document.Blocks.LastBlock); output.Document.Blocks.Add(p); output.Document.Blocks.Add(new Paragraph {Margin = new Thickness()}); // Restore left alignment output.ScrollToEnd(); }
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { var te = new TraceEvent { Cache = eventCache, Source = source, Type = eventType, Id = id, Format = format, Args = args }; Events.Add(te); try { if (Events.Count > 1000) { Events.RemoveAt(0); } } catch (Exception) {} if (OnEventAdd != null) { OnEventAdd.Invoke(te); } }
public override void WriteLine(string message) { var te = new TraceEvent { Cache = new TraceEventCache(), Message = message + Environment.NewLine, Type = TraceEventType.Information }; Events.Add(te); try { if (Events.Count > 1000) { Events.RemoveAt(0); } } catch (Exception) { } if (OnEventAdd != null) { OnEventAdd.Invoke(te); } }
private void AddEvent(TraceEvent te) { Dispatcher.Invoke(new Action<TraceEvent>(IAddEvent), new object[] {te}); }