public void OnLog(string Log) { try { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.InvokeRequired) { SetLogCallback d = new SetLogCallback(OnLog); this.Invoke(d, new object[] { Log }); } else { if (sw == null) { sw = new System.IO.StreamWriter(string.Format("{0}\\{1}.log", System.Environment.CurrentDirectory, System.DateTime.Now.ToString("yyyyMMdd HHmmss")), true); } sw.WriteLine(Log); } } catch (Exception) { } }
private void appendLog(string log) { if (logBox.InvokeRequired) { SetLogCallback d = appendLog; Invoke(d, log); } else { logBox.Text += log; } }
public static void Log(string output) { if (Program.mw.InvokeRequired) { SetLogCallback d = new SetLogCallback(Log); Program.mw.labelStatus.Invoke(d, new object[] { output }); } else { Program.mw.labelStatus.Text = output; } }
public static void SetLog(ListView listView, ListViewItem item) { if (listView.InvokeRequired) { SetLogCallback d = new SetLogCallback(SetLog); Program.MainForm.Invoke(d, new object[] { listView, item }); } else { listView.Items.Add(item); item.EnsureVisible(); } }
public void LogMessage(string msg) { if (txtLog.InvokeRequired) { SetLogCallback callback = new SetLogCallback(LogMessage); Invoke(callback, new object[] { msg }); } else { txtLog.AppendText(msg); txtLog.AppendText(Environment.NewLine); } }
public static void DebugInfo(string str) { str = str + "\r\n"; if (myForm.TextBoxInfo.InvokeRequired) { SetLogCallback d = new SetLogCallback(DebugInfo); myForm.TextBoxInfo.Invoke(d, new object[] { str }); } else { myForm.TextBoxInfo.AppendText(str); } }
public void OnLog(string Log) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.TxtLog.InvokeRequired) { SetLogCallback d = new SetLogCallback(OnLog); this.Invoke(d, new object[] { Log }); } else { this.AddLogLine("Log: " + Log); } }
private void AppendToLogText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.richTextBoxLog.InvokeRequired) { SetLogCallback d = new SetLogCallback(AppendToLogText); this.Invoke(d, new object[] { text }); this.Update(); } else { this.richTextBoxLog.AppendText(text); } }
void LogMessage_LogAdded(object sender, EventArgs e) { try { if (this.richLog.InvokeRequired || this.statusStrip.InvokeRequired) { if (!IsHandleCreated) return; SetLogCallback d = new SetLogCallback(InvokeLogger); this.Invoke(d, new object[] { Log.GetLastLog() }); } else { InvokeLogger(Log.GetLastLog()); } } catch (Exception ex) { Console.WriteLine("Exception at LogMessage_LogAdded() " + ex.Message); } }
private void SetLog(object[] o) { if (this.lstStatusLog.InvokeRequired) { SetLogCallback d = new SetLogCallback(SetLog); this.Invoke(d, new object[] { o }); } else { this.lstStatusLog.Items.AddRange(o); } }
private void SetLog(string text) { if (this.TxtPerformansLog.InvokeRequired) { SetLogCallback d = new SetLogCallback(SetLog); this.Invoke(d, new object[] { text }); } else { this.TxtPerformansLog.AppendText(text); } }