public static void Log(string s, object color = null) { if (box == null) { return; } try { box.Invoke(new Action(delegate { string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : "; Color c; if (color != null) { c = (Color)color; } else { c = Color.Black; } box.SelectionStart = box.TextLength; box.SelectionLength = 0; box.SelectionColor = c; box.AppendText(stamp + s + "\n"); BackendLog.Write(stamp + s + "\n"); box.SelectionColor = box.ForeColor; box.ScrollToCaret(); })); } catch { } }
public static void Log(string s) { if (box == null) { return; } try { box.Invoke(new Action(delegate { string stamp = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " : "; box.AppendText(stamp + s + "\n"); BackendLog.Write(stamp + s + "\n"); box.SelectionStart = box.Text.Length; box.ScrollToCaret(); })); } catch { } }