Beispiel #1
0
 static void MessageBoxShow(Houston owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     if (!owner.InvokeRequired)
     {
         MessageBox.Show(owner, text, caption, buttons, icon);
     }
     else
     {
         owner.Invoke(new MessageBoxShowDelegate(MessageBoxShow), new object[] { owner, text, caption, buttons, icon });
     }
 }
Beispiel #2
0
 public void WriteToLog(string s)
 {
     if (!_houston.InvokeRequired)
     {
         string addLine = DateTime.Now.ToString() + " " + FileName + ": " + s + "\r\n";
         if (_houston.logBox.Text.Length + addLine.Length > _houston.logBox.MaxLength)
         {
             _houston.logBox.Text = _houston.logBox.Text.Substring(addLine.Length);
         }
         _houston.logBox.AppendText(addLine);
     }
     else //We are on a non GUI thread.
     {
         WriteToLogDelegate wtlDel = new WriteToLogDelegate(WriteToLog);
         _houston.Invoke(wtlDel, new object[] { s });
     }
 }