//source is the is "source" of the event - in this case it is the timer //well, the source should be whatever object invoked the event, //which in this case seems to some Timer, private void OnChanged(object source, FileSystemEventArgs dave) {//eventhandler WatcherChangeTypes wct = dave.ChangeType; string fullpath = dave.FullPath; string m = fullpath + " " + wct.ToString(); MessageBox.Show(fullpath + " was " + wct.ToString(), "File was " + wct.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information); changes.Add(m); lbxShowChanges.DataSource = null; lbxShowChanges.DataSource = changes; lblUpdateChange.Visible = true; lblUpdateChange.Text = m; ch++; Changes c = new Changes(); mydel = new Del(WriteChange); c.Full = fullpath; c.Changetype = wct.ToString(); mydel(c); }
//eventhandler private void OnRenamed(object source, RenamedEventArgs rick) { WatcherChangeTypes wct = rick.ChangeType; string fullpath = rick.FullPath; string oldpath = rick.OldFullPath; string m = oldpath + " " + fullpath + " " + wct.ToString(); MessageBox.Show(oldpath + " was " + wct.ToString() + " to " + fullpath, "File was " + wct.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information); changes.Add(m); lbxShowChanges.DataSource = null; lbxShowChanges.DataSource = changes; lblUpdateChange.Visible = true; lblUpdateChange.Text = m; ch++; Changes c = new Changes(); mydel = new Del(WriteChange); c.Full = fullpath; c.Changetype = wct.ToString(); mydel(c); }
public void WriteChange(Changes c) { fh.WriterRename(c); }