How do I do a RaiseEvent in csharp
I'm ok in VB but csharp confused me a lot.
******* code ********
private FileSystemWatcher watcher = new FileSystemWatcher();
public delegate void Changed(WatcherChangeTypes exch);
public delegate void Created(string fileName);
public delegate void ReCreated(string OldName, string newName);
public delegate void OverRun(string Message);
public FileWatcher()
{
watcher.Path = "C:\\";
//* Watch for changes in LastAccess and LastWrite times, and
// the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter = "*.txt";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
watcher.Error += new ErrorEventHandler(OnError);
// Begin watching.
watcher.EnableRaisingEvents = true;
}
protected virtual void OnChanged(object sender, FileSystemEventArgs e)
{
///////////////////////////////////////// THIS IS WHERE IT DOESN'T WORK
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//Changed(e.ChangeType);
}
protected virtual void OnCreated(object sender, FileSystemEventArgs e)
{
///////////////////////////////////////// THIS IS WHERE IT DOESN'T WORK
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//RaiseEvent Created(e.FullPath);
}
protected virtual void OnRenamed(object sender , RenamedEventArgs a)
{
///////////////////////////////////////// THIS IS WHERE IT DOESN'T WORK
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//RaiseEvent ReCreated(e.OldFullPath, e.FullPath);
}
Thank you