private void button1_Click(object sender, EventArgs e) { changeMethodDelegate changeWatchmethod = new changeMethodDelegate(InvokeMethod); renameMethodDelegate renameWatchmethod = new renameMethodDelegate(InvokeMethod); w1 = new Watcher(System.Configuration.ConfigurationSettings.AppSettings["WatchForder"]//Settings1.Default.WatchForder , System.Configuration.ConfigurationSettings.AppSettings["FileFilter"]//Settings1.Default.FileFilter , changeWatchmethod , renameWatchmethod); w1.StartWatch(); WatcherTimerDelegate writelog = new WatcherTimerDelegate(log); tr.setOutMsg = writelog; tr.Start(); }
private void log(string arglog) { if (base.InvokeRequired) { try { WatcherTimerDelegate logmethod = new WatcherTimerDelegate(this.log); Invoke(logmethod, new object[] { arglog }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else richTextBox1.AppendText(arglog); }