using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace vmsnet { public partial class fLog : Form { public fLog() { InitializeComponent(); PUB.log.RaiseMsg += Log_RaiseMsg; this.FormClosed += (s1, e1) => { PUB.log.RaiseMsg -= Log_RaiseMsg; this.Dispose(); }; } private void Log_RaiseMsg(DateTime LogTime, string TypeStr, string Message) { addmsg(Message); } void addmsg(string mbox) { if (this.richTextBox1.InvokeRequired) { this.richTextBox1.BeginInvoke(new Action(() => { this.richTextBox1.AppendText(mbox + "\n"); this.richTextBox1.ScrollToCaret(); })); } else { this.richTextBox1.AppendText(mbox + "\n"); this.richTextBox1.ScrollToCaret(); } } private void fLog_Load(object sender, EventArgs e) { } } }