//Occurs when the file is changed void Watcher_Changed(object sender, LogWatcherEventArgs e) { //Invoke the AppendText method if required if (TextBox.InvokeRequired) { this.Invoke(new Action(delegate() { AppendText(e.Contents); })); } else { AppendText(e.Contents); } }
//Occurs when the file is changed public void OnChanged(object o, FileSystemEventArgs e) { //Read the new text from the file string Contents = Reader.ReadToEnd(); //Fire the TextChanged event LogWatcherEventArgs args = new LogWatcherEventArgs(Contents); if (TextChanged != null) { TextChanged(this, args); } }