##// END OF EJS Templates
Working on text scanner
Working on text scanner

File last commit:

r48:d9d794b61bb9 interactive logger
r172:92d5278d1b10 ref20160224
Show More
TraceForm.cs
53 lines | 1.8 KiB | text/x-csharp | CSharpLexer
cin
initial work on interactive logger
r45 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Implab.Diagnostics.Interactive {
public partial class TraceForm : Form {
cin
refactoring, interactive tarce log almost complete
r47 readonly Dictionary<int, Color> m_threadColors = new Dictionary<int,Color>();
readonly Random m_rand = new Random();
cin
Interactive tracing...
r48 public event EventHandler PauseEvents;
public event EventHandler ResumeEvents;
cin
initial work on interactive logger
r45 public TraceForm() {
InitializeComponent();
}
protected override void OnFormClosing(FormClosingEventArgs e) {
base.OnFormClosing(e);
if (!e.Cancel && e.CloseReason == CloseReason.UserClosing) {
e.Cancel = true;
Hide();
}
}
cin
refactoring, interactive tarce log almost complete
r47
public void AddTraceEvent(TraceViewItem item) {
traceViewItemBindingSource.Add(item);
cin
Interactive tracing...
r48 eventsDataGrid.FirstDisplayedScrollingRowIndex = eventsDataGrid.RowCount - 1;
cin
refactoring, interactive tarce log almost complete
r47 }
Color GetThreadColor(int thread) {
Color result;
if (!m_threadColors.TryGetValue(thread, out result)) {
result = Color.FromArgb(m_rand.Next(4)*64, m_rand.Next(4)*64, m_rand.Next(4)*64);
m_threadColors[thread] = result;
}
return result;
}
private void eventsDataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) {
var data = (TraceViewItem)traceViewItemBindingSource[e.RowIndex];
cin
Interactive tracing...
r48 if (e.ColumnIndex == messageDataGridViewTextBoxColumn.Index)
e.CellStyle.Padding = new Padding(data.Indent * 10,0,0,0);
cin
refactoring, interactive tarce log almost complete
r47 e.CellStyle.ForeColor = GetThreadColor(data.Thread);
}
cin
initial work on interactive logger
r45 }
}