/* * Object handles logging of a log event to the window * @param le is the log event object to be logged */ public void AddLogEvent(LogEvent le) { // if the log event is sent from a thread other than the UI thread, invoke it if (listBox1.InvokeRequired) { LogCenter.NewLogEvent d = new LogCenter.NewLogEvent(AddLogEvent); listBox1.Invoke(d, new object[] { le }); } // else log the message else { LogEvent e = (LogEvent)le; listBox1.Items.Insert(0, e.ToString()); while (listBox1.Items.Count > 1000) { listBox1.Items.RemoveAt(1000); } } }
/* * Object handles logging of a log event to the window * @param le is the log event object to be logged */ public void AddLogEvent(LogEvent le) { // if the log event is sent from a thread other than the UI thread, invoke it if (listBox1.InvokeRequired) { LogCenter.NewLogEvent d = new LogCenter.NewLogEvent(AddLogEvent); listBox1.Invoke(d, new object[] { le }); } // else log the message else { LogEvent e = (LogEvent)le; listBox1.Items.Insert(0, e.time.ToString() + " " + e.Module + ": " + e.Message); while (listBox1.Items.Count > 1000) { listBox1.Items.RemoveAt(1000); } } }