diff Implab.Diagnostics.Interactive/TraceForm.cs @ 48:d9d794b61bb9 interactive logger

Interactive tracing Improved working with tracing contexts
author cin
date Fri, 18 Apr 2014 12:34:45 +0400
parents b181f7bcb259
children cbb0bd8fc0d1
line wrap: on
line diff
--- a/Implab.Diagnostics.Interactive/TraceForm.cs	Thu Apr 17 18:49:36 2014 +0400
+++ b/Implab.Diagnostics.Interactive/TraceForm.cs	Fri Apr 18 12:34:45 2014 +0400
@@ -13,9 +13,12 @@
         readonly Dictionary<int, Color> m_threadColors = new Dictionary<int,Color>();
         readonly Random m_rand = new Random();
 
+        public event EventHandler PauseEvents;
+
+        public event EventHandler ResumeEvents;
+
         public TraceForm() {
             InitializeComponent();
-
         }
 
         protected override void OnFormClosing(FormClosingEventArgs e) {
@@ -26,18 +29,9 @@
             }
         }
 
-        public void AddTraceEvent(int indent, int thread, string message) {
-            traceViewItemBindingSource.Add(new TraceViewItem {
-                Indent = indent,
-                Thread = thread,
-                Message = message,
-                Timestamp = Environment.TickCount
-            });
-
-        }
-
         public void AddTraceEvent(TraceViewItem item) {
             traceViewItemBindingSource.Add(item);
+            eventsDataGrid.FirstDisplayedScrollingRowIndex = eventsDataGrid.RowCount - 1;
         }
 
         Color GetThreadColor(int thread) {
@@ -51,7 +45,8 @@
 
         private void eventsDataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) {
             var data = (TraceViewItem)traceViewItemBindingSource[e.RowIndex];
-            e.CellStyle.Padding = new Padding(data.Indent * 10,0,0,0);
+            if (e.ColumnIndex == messageDataGridViewTextBoxColumn.Index)
+                e.CellStyle.Padding = new Padding(data.Indent * 10,0,0,0);
             e.CellStyle.ForeColor = GetThreadColor(data.Thread);
         }
     }