P
PointMan
there is class A...
class A
{
FileSystemWatcher watcher;
public void Start()
{
fs= new FileSystemWatcher();
fs.Path = "C:\TEMP";
fs.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
fs.Filter = filter;
// Add event handlers.
fs.Created += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = true;
}
public void StopTicker()
{
fs.EnableRaisingEvents = false;
}
// public event Created FileWatcherChanged;
void OnChanged(object source, FileSystemEventArgs e)
{
// some code
}
}
and then i want to use this class on main class
especially, OnChanged want to use main class like this.
class main
{
a = new a();
a.Created += new FileSystemEventHandler(OnChanged);
a.Start();
}
void OnChanged(object source, FileSystemEventArgs e)
{
// some code
}
how can i have to do>?
class A
{
FileSystemWatcher watcher;
public void Start()
{
fs= new FileSystemWatcher();
fs.Path = "C:\TEMP";
fs.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
fs.Filter = filter;
// Add event handlers.
fs.Created += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = true;
}
public void StopTicker()
{
fs.EnableRaisingEvents = false;
}
// public event Created FileWatcherChanged;
void OnChanged(object source, FileSystemEventArgs e)
{
// some code
}
}
and then i want to use this class on main class
especially, OnChanged want to use main class like this.
class main
{
a = new a();
a.Created += new FileSystemEventHandler(OnChanged);
a.Start();
}
void OnChanged(object source, FileSystemEventArgs e)
{
// some code
}
how can i have to do>?