Hello,
I am watching a directory so i am using system watcher and on the event handler, I would like when the event happens, to execute a function that does a specific job. How can i call a function inside the event handler or a way to say that when the event happens, go and do what is written in the following function. Thanks in Advance
- static void OnChanged(object source, FileSystemEventArgs e)
- {
- // Specify what is done when a file is changed, created, or deleted.
- Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
- SomeGlobalVariables.counter++;
- SomeGlobalVariables.Range = SomeGlobalVariables.counter + 1;
- Console.WriteLine("Counter is" + SomeGlobalVariables.counter + "," + "Range is" + SomeGlobalVariables.Range);
- // Call function ReadData(string[,]Result)
- }
- static void ReadDATA(out string[,] Result)
- {
- // Operation
- // Or should i call the event handler here?
- }
Tapan PatelPosted Oct 6, 2016, 2:21 PM