there is class A...
class A
{
FileSystemWatch er watcher;
public void Start()
{
fs= new FileSystemWatch er();
fs.Path = "C:\TEMP";
fs.NotifyFilter =
NotifyFilters.L astAccess | NotifyFilters.L astWrite |
NotifyFilters.F ileName | NotifyFilters.D irectoryName;
fs.Filter = filter;
// Add event handlers.
fs.Created += new FileSystemEvent Handler(OnChang ed);
watcher.EnableR aisingEvents = true;
}
public void StopTicker()
{
fs.EnableRaisin gEvents = false;
}
// public event Created FileWatcherChan ged;
void OnChanged(objec t source, FileSystemEvent Args 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 FileSystemEvent Handler(OnChang ed);
a.Start();
}
void OnChanged(objec t source, FileSystemEvent Args e)
{
// some code
}
how can i have to do>?
class A
{
FileSystemWatch er watcher;
public void Start()
{
fs= new FileSystemWatch er();
fs.Path = "C:\TEMP";
fs.NotifyFilter =
NotifyFilters.L astAccess | NotifyFilters.L astWrite |
NotifyFilters.F ileName | NotifyFilters.D irectoryName;
fs.Filter = filter;
// Add event handlers.
fs.Created += new FileSystemEvent Handler(OnChang ed);
watcher.EnableR aisingEvents = true;
}
public void StopTicker()
{
fs.EnableRaisin gEvents = false;
}
// public event Created FileWatcherChan ged;
void OnChanged(objec t source, FileSystemEvent Args 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 FileSystemEvent Handler(OnChang ed);
a.Start();
}
void OnChanged(objec t source, FileSystemEvent Args e)
{
// some code
}
how can i have to do>?
Comment