// ----------------------------------------- /// <summary> /// Set a textbox to mirror the debug output /// </summary> /// <param name="box"></param> //[Conditional("DEBUG")] public static void attachTextBox(TextBox box) { // Just point to a new box detachTextBox(); textBoxTrace = new TextBoxTraceListener(box); Debug.Listeners.Add(textBoxTrace); }// -----------------------------------------
}// ----------------------------------------- // -- // Call this on the destructor of forms you attach a box public static void detachTextBox() { if(textBoxTrace!=null) { Trace.Listeners.Remove(textBoxTrace); textBoxTrace.Dispose(); textBoxTrace = null; } }// -----------------------------------------
}// ----------------------------------------- // -- // Call this on the destructor of forms you attach a box public static void detachTextBox() { if(textBoxTrace!=null) { LOG.log("Detaching"); Debug.Listeners.Remove(textBoxTrace); textBoxTrace.Dispose(); textBoxTrace = null; } }// -----------------------------------------
}// ----------------------------------------- /// <summary> /// Set a textbox to mirror the debug output. /// ALSO it copies the entire log history so far. /// </summary> /// <param name="box"></param> public static void attachTextBox(TextBoxBase box,bool copyHistory = false) { // Just point to a new box detachTextBox(); // Just in case textBoxTrace = new TextBoxTraceListener(box); Trace.Listeners.Add(textBoxTrace); // -- if(copyHistory){ box.AppendText(history.ToString()); } }// -----------------------------------------